SoapHttpClientProtocol.Discover Method

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

[Visual Basic]
Public Sub Discover()
public void Discover();
public: void Discover();
public function Discover();


Exception Type Condition
Exception The binding defined in the proxy class could not be found in the discovery document at Url.
Exception The proxy class does not have a binding defined.


An XML Web service client can dynamically bind to an XML Web service other than the one referenced in the proxy class using the Discover method. Typically, the Url property refers to the base address of the XML Web service, however prior to invoking the Discover method, set the Url property to a URL of a discovery document. Invoking the 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, future method invocations are directed to the XML Web service described in the discovery document.

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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

SoapHttpClientProtocol Class | SoapHttpClientProtocol Members | System.Web.Services.Protocols Namespace | WebServiceBindingAttribute | XML Web Service Discovery