HttpWebClientProtocol Class

The base class for all XML Web service client proxies that use the HTTP transport protocol.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)

public ref class HttpWebClientProtocol abstract : public WebClientProtocol

The HttpWebClientProtocol type exposes the following members.

Protected methodHttpWebClientProtocolInitializes a new instance of the HttpWebClientProtocol class.

Public propertyAllowAutoRedirectGets or sets whether the client automatically follows server redirects.
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event. (Inherited from Component.)
Public propertyClientCertificatesGets the collection of client certificates.
Public propertyConnectionGroupNameGets or sets the name of the connection group for the request. (Inherited from WebClientProtocol.)
Public propertyContainerGets the IContainer that contains the Component. (Inherited from Component.)
Public propertyCookieContainerGets or sets the collection of cookies.
Public propertyCredentialsGets or sets security credentials for XML Web service client authentication. (Inherited from WebClientProtocol.)
Protected propertyDesignModeGets a value that indicates whether the Component is currently in design mode. (Inherited from Component.)
Public propertyEnableDecompressionGets or sets a Boolean that indicates whether decompression is enabled for this HttpWebClientProtocol.
Protected propertyEventsGets the list of event handlers that are attached to this Component. (Inherited from Component.)
Public propertyPreAuthenticateGets or sets whether pre-authentication is enabled. (Inherited from WebClientProtocol.)
Public propertyProxyGets or sets proxy information for making an XML Web service request through a firewall.
Public propertyRequestEncodingThe Encoding used to make the client request to the XML Web service. (Inherited from WebClientProtocol.)
Public propertySiteGets or sets the ISite of the Component. (Inherited from Component.)
Public propertyTimeoutIndicates the time an XML Web service client waits for the reply to a synchronous XML Web service request to arrive (in milliseconds). (Inherited from WebClientProtocol.)
Public propertyUnsafeAuthenticatedConnectionSharingGets or sets a value that indicates whether connection sharing is enabled when the client uses NTLM authentication to connect to the Web server that hosts the XML Web service.
Public propertyUrlGets or sets the base URL of the XML Web service the client is requesting. (Inherited from WebClientProtocol.)
Public propertyUseDefaultCredentialsGets or sets a value that indicates whether to set the Credentials property to the value of the CredentialCache::DefaultCredentials property. (Inherited from WebClientProtocol.)
Public propertyUserAgentGets or sets the value for the user agent header that is sent with each request.

Public methodAbortCancels a request to an XML Web service method. (Inherited from WebClientProtocol.)
Protected methodCancelAsyncCancels an asynchronous call to an XML Web service method, unless the call has already completed.
Public methodCreateObjRefCreates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. (Inherited from MarshalByRefObject.)
Public methodDispose()Releases all resources used by the Component. (Inherited from Component.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the Component and optionally releases the managed resources. (Inherited from Component.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeReleases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection. (Inherited from Component.)
Public methodStatic memberGenerateXmlMappings(Type, ArrayList)Gets the XmlMembersMapping for each XML Web service method exposed by the specified type, and stores the mappings in the specified ArrayList.
Public methodStatic memberGenerateXmlMappings(array<Type>, ArrayList)Gets the XmlMembersMapping for each XML Web service method exposed by the specified types, and stores the mappings in the specified ArrayList, as well as in a Hashtable that this method returns.
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetLifetimeServiceRetrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodGetServiceReturns an object that represents a service provided by the Component or by its Container. (Inherited from Component.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetWebRequestCreates a WebRequest for the specified URI. (Overrides WebClientProtocol::GetWebRequest(Uri).)
Protected methodGetWebResponse(WebRequest)Returns a response from a synchronous request to an XML Web service method. (Overrides WebClientProtocol::GetWebResponse(WebRequest).)
Protected methodGetWebResponse(WebRequest, IAsyncResult)Returns a response from an asynchronous request to an XML Web service method. (Overrides WebClientProtocol::GetWebResponse(WebRequest, IAsyncResult).)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodMemberwiseClone()Creates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMemberwiseClone(Boolean)Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject.)
Public methodToStringReturns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from Component.)

Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)

The properties on this class are used to control the behavior of the HTTP request object used to transmit the XML Web service request and response. The properties map to properties found on HttpWebRequest.

To communicate with an XML Web service using HTTP, you must create a proxy class deriving indirectly or directly from HttpWebClientProtocol for the XML Web service. Instead of creating the proxy class manually, you can use the Wsdl.exe tool to create a proxy class for a given XML Web service's service description.

Since HttpWebClientProtocol is the base class for all proxy classes, its properties are on your proxy classes. These properties are useful for controlling the request behavior of the underlying transport. For example, use the Proxy property for calling XML Web services through a firewall. Many of these properties are used to initialize the HttpWebRequest that makes the Web request.

SoapHttpClientProtocol, HttpGetClientProtocol, and HttpPostClientProtocol derive directly or indirectly from HttpWebClientProtocol to provide support for SOAP, HTTP-GET and HTTP-POST respectively.

The following example is an ASP.NET Web Form, which calls an XML Web service named Math. Within the EnterBtn_Click function, the Web Form allows the server to automatically redirect the client to other sites. It also sets client authentication credentials, proxy settings, the request encoding and the time out for the request before calling the XML Web service method.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

The properties on this class are copied into a new instance of a WebRequest object for each XML Web service method call. While you can call XML Web service methods on the same WebClientProtocol instance from different threads at the same time, there is no synchronization done to ensure that a consistent snapshot of the properties gets transferred to the WebRequest object. Therefore, if you need to modify the properties and make concurrent method calls from different threads you should use a different instance of the XML Web service proxy or provide your own synchronization.