HttpSimpleClientProtocol Class
TOC
Collapse the table of content
Expand the table of content

HttpSimpleClientProtocol Class

 

Represents the base class for communicating with an XML Web service using the simple HTTP-GET and HTTP-POST protocols bindings.

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

System.Object
  System.MarshalByRefObject
    System.ComponentModel.Component
      System.Web.Services.Protocols.WebClientProtocol
        System.Web.Services.Protocols.HttpWebClientProtocol
          System.Web.Services.Protocols.HttpSimpleClientProtocol
            System.Web.Services.Protocols.HttpGetClientProtocol
            System.Web.Services.Protocols.HttpPostClientProtocol

[ComVisibleAttribute(true)]
public abstract class HttpSimpleClientProtocol : HttpWebClientProtocol

NameDescription
System_CAPS_protmethodHttpSimpleClientProtocol()

Initializes a new instance of the HttpSimpleClientProtocol class.

NameDescription
System_CAPS_pubpropertyAllowAutoRedirect

Gets or sets whether the client automatically follows server redirects.(Inherited from HttpWebClientProtocol.)

System_CAPS_protpropertyCanRaiseEvents

Gets a value indicating whether the component can raise an event.(Inherited from Component.)

System_CAPS_pubpropertyClientCertificates

Gets the collection of client certificates.(Inherited from HttpWebClientProtocol.)

System_CAPS_pubpropertyConnectionGroupName

Gets or sets the name of the connection group for the request.(Inherited from WebClientProtocol.)

System_CAPS_pubpropertyContainer

Gets the IContainer that contains the Component.(Inherited from Component.)

System_CAPS_pubpropertyCookieContainer

Gets or sets the collection of cookies.(Inherited from HttpWebClientProtocol.)

System_CAPS_pubpropertyCredentials

Gets or sets security credentials for XML Web service client authentication.(Inherited from WebClientProtocol.)

System_CAPS_protpropertyDesignMode

Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component.)

System_CAPS_pubpropertyEnableDecompression

Gets or sets a value that indicates whether decompression is enabled for this HttpWebClientProtocol. (Inherited from HttpWebClientProtocol.)

System_CAPS_protpropertyEvents

Gets the list of event handlers that are attached to this Component.(Inherited from Component.)

System_CAPS_pubpropertyPreAuthenticate

Gets or sets whether pre-authentication is enabled.(Inherited from WebClientProtocol.)

System_CAPS_pubpropertyProxy

Gets or sets proxy information for making an XML Web service request through a firewall.(Inherited from HttpWebClientProtocol.)

System_CAPS_pubpropertyRequestEncoding

The Encoding used to make the client request to the XML Web service.(Inherited from WebClientProtocol.)

System_CAPS_pubpropertySite

Gets or sets the ISite of the Component.(Inherited from Component.)

System_CAPS_pubpropertyTimeout

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

System_CAPS_pubpropertyUnsafeAuthenticatedConnectionSharing

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

System_CAPS_pubpropertyUrl

Gets or sets the base URL of the XML Web service the client is requesting.(Inherited from WebClientProtocol.)

System_CAPS_pubpropertyUseDefaultCredentials

Gets or sets a value that indicates whether to set the Credentials property to the value of the CredentialCache.DefaultCredentials property.(Inherited from WebClientProtocol.)

System_CAPS_pubpropertyUserAgent

Gets or sets the value for the user agent header that is sent with each request.(Inherited from HttpWebClientProtocol.)

NameDescription
System_CAPS_pubmethodAbort()

Cancels a request to an XML Web service method.(Inherited from WebClientProtocol.)

System_CAPS_protmethodBeginInvoke(String, String, Object[], AsyncCallback, Object)

Starts an asynchronous invocation of a method of an XML Web service.

System_CAPS_protmethodCancelAsync(Object)

Cancels an asynchronous call to an XML Web service method, unless the call has already completed.(Inherited from HttpWebClientProtocol.)

System_CAPS_pubmethodCreateObjRef(Type)

Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodDispose()

Releases all resources used by the Component.(Inherited from Component.)

System_CAPS_protmethodDispose(Boolean)

Releases the unmanaged resources used by the Component and optionally releases the managed resources.(Inherited from Component.)

System_CAPS_protmethodEndInvoke(IAsyncResult)

Completes asynchronous invocation of an XML Web service method using HTTP.

System_CAPS_pubmethodEquals(Object)

Determines whether the specified object is equal to the current object.(Inherited from Object.)

System_CAPS_protmethodFinalize()

Releases unmanaged resources and performs other cleanup operations before the Component is reclaimed by garbage collection.(Inherited from Component.)

System_CAPS_pubmethodGetHashCode()

Serves as the default hash function. (Inherited from Object.)

System_CAPS_pubmethodGetLifetimeService()

Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodGetService(Type)

Returns an object that represents a service provided by the Component or by its Container.(Inherited from Component.)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodGetWebRequest(Uri)

Creates a WebRequest for the specified URI.(Inherited from HttpWebClientProtocol.)

System_CAPS_protmethodGetWebResponse(WebRequest)

Returns a response from a synchronous request to an XML Web service method.(Inherited from HttpWebClientProtocol.)

System_CAPS_protmethodGetWebResponse(WebRequest, IAsyncResult)

Returns a response from an asynchronous request to an XML Web service method.(Inherited from HttpWebClientProtocol.)

System_CAPS_pubmethodInitializeLifetimeService()

Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject.)

System_CAPS_protmethodInvoke(String, String, Object[])

Invokes an XML Web service method using HTTP.

System_CAPS_protmethodInvokeAsync(String, String, Object[], SendOrPostCallback)

Invokes the specified method asynchronously.

System_CAPS_protmethodInvokeAsync(String, String, Object[], SendOrPostCallback, Object)

Invokes the specified method asynchronously while maintaining an associated state.

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodMemberwiseClone(Boolean)

Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject.)

System_CAPS_pubmethodToString()

Returns a String containing the name of the Component, if any. This method should not be overridden.(Inherited from Component.)

NameDescription
System_CAPS_pubeventDisposed

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

This class specifies most of the implementation for communicating with an XML Web service over HTTP using encoders to encode the parameters and return values into common MIME formats. These encoders derive from the MimeFormatter class. By default, a proxy class deriving from HttpSimpleClientProtocol encodes parameters using the application/x-www-form-urlencoded MIME type and the response in plain XML. Custom mime formatters can be specified using the HttpMethodAttribute attribute, however, there is no support for integrating this into a service description and proxy generation.

Notes to Inheritors: When you override this class, you can introduce methods in the derived class that are specific to a particular type of an XML Web service. The methods simply capture the parameters, and call the base class to do the work of communicating with the site. If the introduced methods are asynchronous, call the BeginInvoke and EndInvoke methods. If the introduced methods are synchronous, call the Invoke method. The overridden constructor typically sets the Url property to the URI of the XML Web service method.

The Web Services Description Language tool (Wsdl.exe) generates derived classes of HttpSimpleClientProtocol for a given Service Description.

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

using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.Web.Services;


public class MyMath : System.Web.Services.Protocols.HttpGetClientProtocol {

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public MyMath() {
        this.Url = "http://www.contoso.com/math.asmx";
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.Web.Services.Protocols.HttpMethodAttribute(typeof(System.Web.Services.Protocols.XmlReturnReader), typeof(System.Web.Services.Protocols.UrlParameterWriter))]
    [return: System.Xml.Serialization.XmlRootAttribute("int", Namespace="http://www.contoso.com/", IsNullable=false)]
    public int Add(string num1, string num2) {
        return ((int)(this.Invoke("Add", (this.Url + "/Add"), new object[] {num1,
                    num2})));
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public System.IAsyncResult BeginAdd(string num1, string num2, System.AsyncCallback callback, object asyncState) {
        return this.BeginInvoke("Add", (this.Url + "/Add"), new object[] {num1,
                    num2}, callback, asyncState);
    }

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    public int EndAdd(System.IAsyncResult asyncResult) {
        return ((int)(this.EndInvoke(asyncResult)));
    }
}

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

using System.Web.Services;
using System;

public class Math {
     [ WebMethod ]
     public int Add(int num1, int num2) {
         return num1+num2;
         }
}

.NET Framework
Available since 1.1

This type is thread safe.

Return to top
Show:
© 2016 Microsoft