Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

How to: Call a Web Service

After you add a Web reference to the XML Web service to your project, you can use the server name to create a proxy object that allows you to call the methods in the XML Web service.

To call a Web service programmatically

  • Use the Web reference name (or server name) as the namespace, and the name of its .WSDL file (or the service name) as the proxy class.

    The following code example calls a Web service method to get a string value. Web service variable names and syntax are highlighted.

    Private Sub Call_Web_Service_Method() 
        Dim CallWebService as New ServerName.WebServiceName() 
        Dim sGetValue as String = CallWebService.MethodName() 
        Label1.Text = sGetValue 
    End Sub 
    

    private void Call_Web_Service_Method()
    {
        ServerName.WebServiceName CallWebService = 
            new ServerName.WebServiceName();
        String sGetValue = CallWebService.MethodName();
        Label1.Text = sGetValue;
    }
    

See Also

Community Additions

ADD
Show:
© 2015 Microsoft