System.Web.Services.Protocols.SoapHttpClientProtocol.Discover Method

Dynamically binds to an XML Web service described in the discovery document at WebClientProtocol.Url.

Syntax

public void Discover ()

Remarks

An XML Web service client can dynamically bind to an XML Web service other than the one referenced in the proxy class using the SoapHttpClientProtocol.Discover method. Typically, the WebClientProtocol.Url property refers to the base address of the XML Web service. However, before invoking the SoapHttpClientProtocol.Discover method, set the WebClientProtocol.Url property to a URL of a discovery document. The SoapHttpClientProtocol.Discover method attempts to find a match in the discovery document to the binding defined in the proxy class and then dynamically bind to it. If successful, subsequent method calls are directed to the XML Web service described in the discovery document.

If the proxy class is built using the Web Services Description Language tool (Wsdl.exe), the proxy class defines the binding implemented by the XML Web service methods it invokes using the System.Web.Services.WebServiceBindingAttribute. When an XML Web service implements multiple bindings, Wsdl.exe creates a proxy class for each binding. Applied to each proxy class is a System.Web.Services.WebServiceBindingAttribute that defines the name of the binding and its namespace. The discovery document you set the WebClientProtocol.Url property to must contain a reference to an XML Web service that implements the same binding name and namespace, or an exception is thrown.

Requirements

Namespace: System.Web.Services.Protocols
Assembly: System.Web.Services (in System.Web.Services.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0