To access the web services SDK from Microsoft Visual Studio perform the following steps



  • Within the solution explorer, right click the project and click Add Service Reference.

       


  • Enter the address for the web service - for example http://localhost/xiaconfiguration/webservice/xiaconfiguration.asmx.
    For more information see the web service settings configuration section.



  • Enter the namespace - for example "XiaWebService", and click OK.

  • Within the application the follow configures the end point address, and uses integrated Windows authentication for the connection.


    EndpointAddress remoteAddress = new EndpointAddress("http://localhost/xiaconfiguration/webservice/xiaconfiguration.asmx");

    BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);

    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

    binding.MaxReceivedMessageSize = 10485760;

    XiaWebService.XiaConfigurationWebServiceSoapClient service = new XiaWebService.XiaConfigurationWebServiceSoapClient(binding, remoteAddress);

    string username = (service.GET_AuthenticatedUserName());