Note that there are some explanatory texts on larger screens.

plurals
  1. PO.NET webservice client from WSDL
    text
    copied!<p>I have a WSDL from which I generated the implementation of <a href="http://msdn.microsoft.com/en-us/library/ms576141.aspx" rel="nofollow">ClientBase</a> namely MyService </p> <pre><code> function void updateData(Data data){ BasicHttpBinding binding = new BasicHttpBinding(); // see there is naked username and password. EndpointAddress address = new EndpointAddress("http://qa.farwaha.com/eai_enu/start.swe?SWEExtSource=WebService&amp;SWEExtCmd=Execute&amp;UserName=john&amp;Password=johspassword"); MyService service = new MyService(binding, address); try{ service.update(data); }finally{ service.close(); } } </code></pre> <p>Unfortunately, to call this web service I have to pass User name and password as shown in the code. so, my question is around best practices. </p> <p>Given that its a Winform Application.</p> <ol> <li><p>How memory / CPU intensive is creating MyService object? </p></li> <li><p>If you suggest cashing the service, it will hold on to the EndpointAddress; which intern has a string with Username and Password. Which is not a good idea .. any work arounds? </p></li> <li>If I keep the code as such, service object will be garbage collected .. and there will be no trace of user name or password (as soon as GC runs)</li> </ol> <p><strong>This is a sample code, I have User Object which stores password in SecureString and every time I have to access the password; I get string from SecureString in an instance private method, use it quickly and let it be garbage collected. I believe if I use a method something like above, it will be safe OR safe enough rather than holding on to reference of Service, What do you suggest !!</strong> </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload