Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

HttpPostClientProtocol Class

The base class for XML Web service client proxies that use the HTTP-POST protocol.

Namespace:  System.Web.Services.Protocols
Assembly:  System.Web.Services (in System.Web.Services.dll)
'Declaration
Public Class HttpPostClientProtocol _
	Inherits HttpSimpleClientProtocol

The HttpPostClientProtocol type exposes the following members.

  NameDescription
Public methodHttpPostClientProtocolInitializes a new instance of the HttpPostClientProtocol class.
Top
  NameDescription
Public propertyAllowAutoRedirectGets or sets whether the client automatically follows server redirects. (Inherited from HttpWebClientProtocol.)
Protected propertyCanRaiseEventsGets a value indicating whether the component can raise an event. (Inherited from Component.)
Public propertyClientCertificatesGets the collection of client certificates. (Inherited from HttpWebClientProtocol.)
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. (Inherited from HttpWebClientProtocol.)
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 value that indicates whether decompression is enabled for this HttpWebClientProtocol. (Inherited from 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. (Inherited from HttpWebClientProtocol.)
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. (Inherited from HttpWebClientProtocol.)
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. (Inherited from HttpWebClientProtocol.)
Top
  NameDescription
Public methodAbortCancels a request to an XML Web service method. (Inherited from WebClientProtocol.)
Protected methodBeginInvokeStarts an asynchronous invocation of a method of an XML Web service. (Inherited from HttpSimpleClientProtocol.)
Protected methodCancelAsyncCancels an asynchronous call to an XML Web service method, unless the call has already completed. (Inherited from HttpWebClientProtocol.)
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 methodDisposeReleases 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.)
Protected methodEndInvokeCompletes asynchronous invocation of an XML Web service method using HTTP. (Inherited from HttpSimpleClientProtocol.)
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 methodGetHashCodeServes as the default hash function. (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 instance for the specified URI. (Overrides HttpWebClientProtocol.GetWebRequest(Uri).)
Protected methodGetWebResponse(WebRequest)Returns a response from a synchronous request to an XML Web service method. (Inherited from HttpWebClientProtocol.)
Protected methodGetWebResponse(WebRequest, IAsyncResult)Returns a response from an asynchronous request to an XML Web service method. (Inherited from HttpWebClientProtocol.)
Public methodInitializeLifetimeServiceObtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject.)
Protected methodInvokeInvokes an XML Web service method using HTTP. (Inherited from HttpSimpleClientProtocol.)
Protected methodInvokeAsync(String, String, Object(), SendOrPostCallback)Invokes the specified method asynchronously. (Inherited from HttpSimpleClientProtocol.)
Protected methodInvokeAsync(String, String, Object(), SendOrPostCallback, Object)Invokes the specified method asynchronously while maintaining an associated state. (Inherited from HttpSimpleClientProtocol.)
Protected methodMemberwiseCloneCreates 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.)
Top
  NameDescription
Public eventDisposedOccurs when the component is disposed by a call to the Dispose method. (Inherited from Component.)
Top

When an XML Web service client uses the HTTP-POST protocol, by default parameters are encoded within the HTTP body using URL encoding rules and uses plain XML for the response. This protocol uses classes that derive from MimeFormatter to encode parameters and return values into standard MIME formats. The encoders to use are specified in the service description.

If you are building an XML Web service client using ASP.NET, then a proxy class deriving indirectly or directly from WebClientProtocol needs to be created for the XML Web service you want to call. When the XML Web service client is calling using HTTP, derive the proxy class HttpSimpleClientProtocol, which in turn derives from WebClientProtocol.

HttpGetClientProtocol and HttpPostClientProtocol derive from HttpSimpleClientProtocol, providing the support for calling an XML Web service method using HTTP-GET and HTTP-POST respectively. Clients calling an XML Web service using SOAP should derive from SoapHttpClientProtocol.

For details on building a proxy class, see [<topic://cpconcreatingwebserviceproxy>].

The following example is a proxy class generated by the Wsdl.exe utility for the Math XML Web service below. The proxy class derives from HttpPostClientProtocol, which derives from the abstract HttpSimpleClientProtocol class.

Option Strict On 
Option Explicit On 

Imports System
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

Public Class MyMath
    Inherits System.Web.Services.Protocols.HttpPostClientProtocol

    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Sub New()
        MyBase.New 
        Me.Url = "http://www.contoso.com/math.asmx" 
    End Sub

    <System.Diagnostics.DebuggerStepThroughAttribute(),  _
     System.Web.Services.Protocols.HttpMethodAttribute(GetType(System.Web.Services.Protocols.XmlReturnReader), GetType(System.Web.Services.Protocols.HtmlFormParameterWriter))>  _
    Public Function Add(ByVal num1 As String, ByVal num2 As String) As <System.Xml.Serialization.XmlRootAttribute("int", [Namespace]:="http://www.contoso.com/", IsNullable:=false)> Integer 
        Return CType(Me.Invoke("Add", (Me.Url + "/Add"), New Object() {num1, num2}),Integer)
    End Function

    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Function BeginAdd(ByVal num1 As String, ByVal num2 As String, ByVal callback As System.AsyncCallback, ByVal asyncState As Object) As System.IAsyncResult
        Return Me.BeginInvoke("Add", (Me.Url + "/Add"), New Object() {num1, num2}, callback, asyncState)
    End Function

    <System.Diagnostics.DebuggerStepThroughAttribute()>  _
    Public Function EndAdd(ByVal asyncResult As System.IAsyncResult) As Integer 
        Return CType(Me.EndInvoke(asyncResult),Integer)
    End Function 
End Class

The following example is the Math XML Web service, from which the previous proxy class was created.

<%@ WebService Language="VB" Class="Math"%>
Imports System.Web.Services
Imports System

Public Class Math
    <WebMethod()> _
    Public Function Add(num1 As Integer, num2 As Integer) As Integer
        Return num1 + num2
    End Function 'Add
End Class 'Math

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.