This documentation is archived and is not being maintained.

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)

[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
public ref class SoapHeaderCollection : public CollectionBase

[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",
   Namespace="http://tempuri.org/")]
public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol
{
public:
   array<SoapHeader^>^ mySoapHeaders;

   [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]
   Single Add( Single xValue, Single yValue )
   {
      SoapHeaderCollection^ mySoapHeaderCollection = gcnew SoapHeaderCollection;
      MySoapHeader^ mySoapHeader;
      mySoapHeader = gcnew MySoapHeader;
      mySoapHeader->text = "This is the first SOAP header";
      mySoapHeaderCollection->Add( mySoapHeader );

      mySoapHeader = gcnew MySoapHeader;
      mySoapHeader->text = "This is the second SOAP header";
      mySoapHeaderCollection->Add( mySoapHeader );

      mySoapHeader = gcnew MySoapHeader;
      mySoapHeader->text = "This header is inserted before the first header";
      mySoapHeaderCollection->Insert( 0, mySoapHeader );

      mySoapHeaders = gcnew array<MySoapHeader^>(mySoapHeaderCollection->Count);
      mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 );

      array<Object^>^ temp0 = {xValue,yValue};
      array<Object^>^ results = this->Invoke( "Add", temp0 );
      return ( (Single)( results[ 0 ] ) );
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   MathSvc()
   {
      this->Url = "http://localhost/MathSvc_SoapHeaderCollection.cs.asmx";
   }

   System::IAsyncResult^ BeginAdd( Single xValue,
      Single yValue, System::AsyncCallback^ callback, Object^ asyncState )
   {
      array<Object^>^ temp1 = {xValue,yValue};
      return this->BeginInvoke( "Add", temp1, callback, asyncState );
   }

   Single EndAdd( System::IAsyncResult^ asyncResult )
   {
      array<Object^>^ results = this->EndInvoke( asyncResult );
      return ( (Single)( results[ 0 ] ) );
   }
};
[System::Web::Services::WebServiceBindingAttribute(Name=S"MathSvcSoap",
   Namespace=S"http://tempuri.org/")]
public __gc class MathSvc : public System::Web::Services::Protocols::SoapHttpClientProtocol
{
public:
   SoapHeader* mySoapHeaders[];

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

      Object* temp0 [] = {__box(xValue), __box(yValue)};
      Object* results[] = this->Invoke(S"Add", temp0);
      return *dynamic_cast<Single*>(results[0]);
   }

   [System::Diagnostics::DebuggerStepThroughAttribute]
   MathSvc()
   {
      this->Url = S"http://localhost/MathSvc_SoapHeaderCollection.cs.asmx";
   }

   System::IAsyncResult* BeginAdd(System::Single xValue,
      System::Single yValue, System::AsyncCallback* callback, Object* asyncState)
   {
      Object* temp1 [] = {__box(xValue), __box(yValue)};
      return this->BeginInvoke(S"Add", temp1, callback, asyncState);
   }

   System::Single EndAdd(System::IAsyncResult* asyncResult)
   {
      Object* results[] = this->EndInvoke(asyncResult);
      return *dynamic_cast<Single*>(results[0]);
   }
};

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 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

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

.NET Framework

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

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0
Show: