Even if you have a local WSDL file saved in your hard drive, the "Add Service Reference" option allows you to specify a local file too. You don't necessarily have to have a HTTP location to add the service reference. That is the correct way to add a reference
to your WebService:

Once you add your service reference you can consume the WebService using a code like below - notice that you can provide the endpoint address as a runtime parameter (txtOut is a simple text box that displays the response):
private async void btnCallWS_Click(object sender, RoutedEventArgs e)
{
try
{
System.ServiceModel.EndpointAddress epAddress = new System.ServiceModel.EndpointAddress("http://<YourWebServer>/HelloWorldWebService/Service.asmx");
System.ServiceModel.BasicHttpBinding basicHttpBinding = new System.ServiceModel.BasicHttpBinding();
HelloWorldWebService.ServiceSoapClient client = new HelloWorldWebService.ServiceSoapClient(basicHttpBinding, epAddress);
HelloWorldWebService.HelloWorldResponse response = await client.HelloWorldAsync("test");
txtOut.Text = response.Body.HelloWorldResult.ToString() ;
}
catch (Exception oEx)
{
txtOut.Text = oEx.Message;
}
}
Windows Store Developer Solutions, follow us on Twitter:
@WSDevSol|| Want more solutions? See our blog