Export (0) Print
Expand All

SoapHeaderCollection Class

Contains a collection of instances of the SoapHeader class.

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

'Declaration
Public Class SoapHeaderCollection
	Inherits CollectionBase
'Usage
Dim instance As SoapHeaderCollection

public class SoapHeaderCollection extends CollectionBase
public class SoapHeaderCollection extends CollectionBase
Not applicable.

<System.Web.Services.WebServiceBindingAttribute(Name := "MathSvcSoap", _
    Namespace := "http://tempuri.org/")>  _
Public Class MathSvc
   Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
   Public mySoapHeaders() As SoapHeader

   <SoapHeaderAttribute("mySoapHeaders", _
      Direction := SoapHeaderDirection.In), _
   System.Web.Services.Protocols.SoapDocumentMethodAttribute( _
      "http://tempuri.org/Add", _
      Use := System.Web.Services.Description.SoapBindingUse.Literal, _
      ParameterStyle := System.Web.Services.Protocols.SoapParameterStyle.Wrapped), _
   MySoapExtensionAttribute()>  _
   Public Function Add(xValue As System.Single, yValue As System.Single) _
      As System.Single
      Dim mySoapHeaderCollection As New SoapHeaderCollection()
      Dim mySoapHeader As MySoapHeader
      mySoapHeader = New MySoapHeader()
      mySoapHeader.text = "This is the first SOAP header"
      mySoapHeaderCollection.Add(mySoapHeader)
      mySoapHeader = New MySoapHeader()
      mySoapHeader.text = "This is the second SOAP header"
      mySoapHeaderCollection.Add(mySoapHeader)
      mySoapHeader = New MySoapHeader()
      mySoapHeader.text = "This header is inserted before the first header"
      mySoapHeaderCollection.Insert(0, mySoapHeader)
      mySoapHeaders = New MySoapHeader(mySoapHeaderCollection.Count-1) {}
      mySoapHeaderCollection.CopyTo(mySoapHeaders, 0)
      Dim results() As Object = _
         Me.Invoke("Add", New Object() {xValue, yValue})
      Return CType(results(0), System.Single)
   End Function 'Add

   <System.Diagnostics.DebuggerStepThroughAttribute()>  _
   Public Sub New()
      Me.Url = "http://localhost/MathSvc_SoapHeaderCollection.vb.asmx"
   End Sub 'New

   Public Function BeginAdd(xValue As System.Single, yValue As System.Single, _
      callback As System.AsyncCallback, asyncState As Object) _
      As System.IAsyncResult
      Return Me.BeginInvoke("Add", New Object() {xValue, yValue}, _
         callback, asyncState)
   End Function 'BeginAdd

   Public Function EndAdd(asyncResult As System.IAsyncResult) As System.Single
      Dim results As Object() = Me.EndInvoke(asyncResult)
      Return CType(results(0), System.Single)
   End Function 'EndAdd
End Class 'MathSvc

/** @attribute System.Web.Services.WebServiceBindingAttribute(
    Name = "MathSvcSoap", Namespace = "http://tempuri.org/")
 */
public class MathSvc extends System.Web.Services.Protocols.
    SoapHttpClientProtocol
{
    public SoapHeader mySoapHeaders[];

    /** @attribute SoapHeaderAttribute("mySoapHeaders", 
        Direction = SoapHeaderDirection.In)
     */
    /** @attribute System.Web.Services.Protocols.SoapDocumentMethodAttribute(
        "http://tempuri.org/Add", Use = System.Web.Services.Description.
        SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.                    SoapParameterStyle.Wrapped)
     */
    /** @attribute MySoapExtensionAttribute()
     */
    public float Add(float xValue, float yValue)
    {
        SoapHeaderCollection mySoapHeaderCollection 
            = new SoapHeaderCollection();
        MySoapHeader mySoapHeader;
        mySoapHeader = new MySoapHeader();
        mySoapHeader.text = "This is the first SOAP header";
        mySoapHeaderCollection.Add(mySoapHeader);
        
        mySoapHeader = new MySoapHeader();
        mySoapHeader.text = "This is the second SOAP header";
        mySoapHeaderCollection.Add(mySoapHeader);
        
        mySoapHeader = new MySoapHeader();
        mySoapHeader.text = "This header is inserted before the first header";
        mySoapHeaderCollection.Insert(0, mySoapHeader);
        
        mySoapHeaders = new MySoapHeader[mySoapHeaderCollection.get_Count()];
        mySoapHeaderCollection.CopyTo(mySoapHeaders, 0);

        Object results[] = this.Invoke("Add", new Object[] { 
            (System.Double)xValue, (System.Double)yValue });
        return (float)(System.Double)results.get_Item(0);
    } //Add

    /** @attribute System.Diagnostics.DebuggerStepThroughAttribute()
     */
    public MathSvc()
    {
        this.set_Url("http://localhost/MathSvc_SoapHeaderCollection.jsl.asmx");
    } //MathSvc

    public System.IAsyncResult BeginAdd(float xValue, float yValue, 
        System.AsyncCallback callBack, Object asyncState)
    {
        return this.BeginInvoke("Add", new Object[] { 
            (System.Double)xValue, (System.Double)yValue }, callBack, 
            asyncState);
    } //BeginAdd

    public float EndAdd(System.IAsyncResult asyncResult)
    {
        Object results[] = this.EndInvoke(asyncResult);
        return (float)(System.Double)results.get_Item(0);
    } //EndAdd
} //MathSvc

System.Object
   System.Collections.CollectionBase
    System.Web.Services.Protocols.SoapHeaderCollection

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft