Export (0) Print
Expand All

SoapHttpClientProtocol.Discover Method

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

[Visual Basic]
Public Sub Discover()
[C#]
public void Discover();
[C++]
public: void Discover();
[JScript]
public function Discover();

Exceptions

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.

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 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.

Requirements

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

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft