- In the 'Solution Explorer', right click 'Web References' and choose 'Add Web Reference', and refer to the service WSDL.
- The client stub for the web service will be automatically generated and added under the namespace 'nl.server', add this namespace to the top of your code by adding 'using nl.server'.
- Add code to add the necessary HTTP headers to the SOAP request. See the example code snippet below.
using System;
using System.Net;
public class ExtendedSomeService : SomeService {
protected override WebRequest GetWebRequest(System.Uri uri)
{
WebRequest req = base.GetWebRequest(uri);
WebHeaderCollection col1= req.Headers;
col1.Add("WASP_APPLICATION", "your_app_name");
return req;
}
}
- Add code to instantiate the web service. The URLs are not added to the WSDL, so add them explicitly:
ExtendedSomeService myExtendedSomeService = new ExtendedSomeService();
myExtendedSomeService.Url = "http://cellid.novay.nl:8080/wasp/services/CellStore2Service";
- If necessary, create a cookiecontainer to enable the service to authenticate your session:
myExtendedSomeService.CookieContainer = new CookieContainer();
bool authenticated = myExtendedSomeService.authenticate("usr","pwd");
- Call the actual operations you need, e.g.
NetworkData[] networks = myExtendedSomeService.listNetworks();