Freigeben über


SoapHeaderBinding Klasse

Definition

Stellt ein Erweiterbarkeitselement dar, das einem InputBinding oder einem OutputBinding innerhalb eines XML-Webdiensts hinzugefügt wurde.

public ref class SoapHeaderBinding : System::Web::Services::Description::ServiceDescriptionFormatExtension
[System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))]
public class SoapHeaderBinding : System.Web.Services.Description.ServiceDescriptionFormatExtension
[<System.Web.Services.Configuration.XmlFormatExtension("header", "http://schemas.xmlsoap.org/wsdl/soap/", typeof(System.Web.Services.Description.InputBinding), typeof(System.Web.Services.Description.OutputBinding))>]
type SoapHeaderBinding = class
    inherit ServiceDescriptionFormatExtension
Public Class SoapHeaderBinding
Inherits ServiceDescriptionFormatExtension
Vererbung
Abgeleitet
Attribute

Beispiele

#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;

int main()
{
   ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" );
   Binding^ myBinding = gcnew Binding;
   myBinding->Name = "MyWebServiceSoap";
   myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" );
   SoapBinding^ mySoapBinding = gcnew SoapBinding;
   mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http";
   mySoapBinding->Style = SoapBindingStyle::Document;
   myBinding->Extensions->Add( mySoapBinding );
   OperationBinding^ myOperationBinding = gcnew OperationBinding;
   myOperationBinding->Name = "Hello";
   SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
   mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello";
   mySoapOperationBinding->Style = SoapBindingStyle::Document;
   myOperationBinding->Extensions->Add( mySoapOperationBinding );

   // Create InputBinding for operation for the 'SOAP' protocol.
   InputBinding^ myInputBinding = gcnew InputBinding;
   SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
   mySoapBodyBinding->Use = SoapBindingUse::Literal;
   myInputBinding->Extensions->Add( mySoapBodyBinding );
   SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding;
   mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" );
   mySoapHeaderBinding->Part = "MyHeader";
   mySoapHeaderBinding->Use = SoapBindingUse::Literal;

   // Add mySoapHeaderBinding to 'myInputBinding' object.
   myInputBinding->Extensions->Add( mySoapHeaderBinding );

   // Create OutputBinding for operation for the 'SOAP' protocol.
   OutputBinding^ myOutputBinding = gcnew OutputBinding;
   myOutputBinding->Extensions->Add( mySoapBodyBinding );

   // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
   myOperationBinding->Input = myInputBinding;
   myOperationBinding->Output = myOutputBinding;
   myBinding->Operations->Add( myOperationBinding );
   myServiceDescription->Bindings->Add( myBinding );
   myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" );
   Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." );
   Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." );
}
   using System;
   using System.Web.Services.Description;
   using System.Collections;
   using System.Xml;

   public class MySampleClass
   {
   public static void Main()
   {
      ServiceDescription myServiceDescription =
         ServiceDescription.Read("SoapHeaderBindingInput_cs.wsdl");
      Binding myBinding = new Binding();
      myBinding.Name = "MyWebServiceSoap";
      myBinding.Type =new XmlQualifiedName("s0:MyWebServiceSoap");

      SoapBinding mySoapBinding =new SoapBinding();
      mySoapBinding.Transport="http://schemas.xmlsoap.org/soap/http";
      mySoapBinding.Style=SoapBindingStyle.Document;
      myBinding.Extensions.Add(mySoapBinding);

      OperationBinding myOperationBinding = new OperationBinding();
      myOperationBinding.Name = "Hello";

      SoapOperationBinding mySoapOperationBinding =
         new SoapOperationBinding();
      mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello";
      mySoapOperationBinding.Style=SoapBindingStyle.Document;
      myOperationBinding.Extensions.Add(mySoapOperationBinding);

      // Create InputBinding for operation for the 'SOAP' protocol.
      InputBinding myInputBinding = new InputBinding();
      SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
      mySoapBodyBinding.Use = SoapBindingUse.Literal;
      myInputBinding.Extensions.Add(mySoapBodyBinding);
      SoapHeaderBinding mySoapHeaderBinding=new SoapHeaderBinding();
      mySoapHeaderBinding.Message=new XmlQualifiedName("s0:HelloMyHeader");
      mySoapHeaderBinding.Part="MyHeader";
      mySoapHeaderBinding.Use=SoapBindingUse.Literal;
      // Add mySoapHeaderBinding to 'myInputBinding' object.
      myInputBinding.Extensions.Add(mySoapHeaderBinding);
      // Create OutputBinding for operation for the 'SOAP' protocol.
      OutputBinding myOutputBinding = new OutputBinding();
      myOutputBinding.Extensions.Add(mySoapBodyBinding);

      // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
      myOperationBinding.Input = myInputBinding;
      myOperationBinding.Output = myOutputBinding;
      myBinding.Operations.Add(myOperationBinding);

      myServiceDescription.Bindings.Add(myBinding);
      myServiceDescription.Write("SoapHeaderBindingOut_cs.wsdl");
      Console.WriteLine("'SoapHeaderBindingOut_cs.wsdl' file is generated.");
      Console.WriteLine("Proxy could be created using "
                           +"'wsdl SoapHeaderBindingOut_cs.wsdl'.");
   }
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Public Class MySampleClass
   Public Shared Sub Main()
      Dim myServiceDescription As ServiceDescription = _
                        ServiceDescription.Read("SoapHeaderBindingInput_vb.wsdl")
      Dim myBinding As New Binding()
      myBinding.Name = "MyWebServiceSoap"
      myBinding.Type = New XmlQualifiedName("s0:MyWebServiceSoap")

      Dim mySoapBinding As New SoapBinding()
      mySoapBinding.Transport = "http://schemas.xmlsoap.org/soap/http"
      mySoapBinding.Style = SoapBindingStyle.Document
      myBinding.Extensions.Add(mySoapBinding)

      Dim myOperationBinding As New OperationBinding()
      myOperationBinding.Name = "Hello"

      Dim mySoapOperationBinding As New SoapOperationBinding()
      mySoapOperationBinding.SoapAction = "http://tempuri.org/Hello"
      mySoapOperationBinding.Style = SoapBindingStyle.Document
      myOperationBinding.Extensions.Add(mySoapOperationBinding)

      ' Create InputBinding for operation for the 'SOAP' protocol.
      Dim myInputBinding As New InputBinding()
      Dim mySoapBodyBinding As New SoapBodyBinding()
      mySoapBodyBinding.Use = SoapBindingUse.Literal
      myInputBinding.Extensions.Add(mySoapBodyBinding)
      Dim mySoapHeaderBinding As New SoapHeaderBinding()
      mySoapHeaderBinding.Message = New XmlQualifiedName("s0:HelloMyHeader")
      mySoapHeaderBinding.Part = "MyHeader"
      mySoapHeaderBinding.Use = SoapBindingUse.Literal
      ' Add mySoapHeaderBinding to 'myInputBinding' object.
      myInputBinding.Extensions.Add(mySoapHeaderBinding)
      ' Create OutputBinding for operation for the 'SOAP' protocol.
      Dim myOutputBinding As New OutputBinding()
      myOutputBinding.Extensions.Add(mySoapBodyBinding)

      ' Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
      myOperationBinding.Input = myInputBinding
      myOperationBinding.Output = myOutputBinding
      myBinding.Operations.Add(myOperationBinding)

      myServiceDescription.Bindings.Add(myBinding)
      myServiceDescription.Write("SoapHeaderBindingOut_vb.wsdl")
      Console.WriteLine("'SoapHeaderBindingOut_vb.wsdl' file is generated.")
      Console.WriteLine("Proxy could be created using " + _
                        "'wsdl /language:VB SoapHeaderBindingOut_vb.wsdl'.")
   End Sub
End Class

Hinweise

Weitere Informationen zum Angeben von Protokollen für XML-Webdienste finden Sie unter XML-Webdienste mit ASP.NET. Weitere Informationen zur Web Services Description Language (WSDL) finden Sie in der WSDL-Spezifikation .

Konstruktoren

SoapHeaderBinding()

Initialisiert eine neue Instanz der SoapHeaderBinding-Klasse.

Eigenschaften

Encoding

Ruft den URI ab, der die Art der Codierung darstellt, mit der der SOAP-Header codiert wurde, oder legt diesen fest.

Fault

Ruft den Erweiterungstyp ab, der die Ausgabe in ein WSDL-Dokument für das headerfault-XML-Element eines SOAP-Headers steuert.

Handled

Ruft einen Wert ab oder legt einen Wert fest, der angibt, ob die ServiceDescriptionFormatExtension durch den Importprozess verwendet wird, wenn das Erweiterbarkeitselement importiert wird.

(Geerbt von ServiceDescriptionFormatExtension)
MapToProperty

Ruft einen Wert ab, der angibt, ob die SoapHeaderBinding-Instanz einer bestimmten Eigenschaft in generierten Proxyklassen zugeordnet ist, oder legt diesen fest.

Message

Ruft einen Wert ab, der den Namen der Message innerhalb des XML-Webdiensts angibt, für den das SoapHeaderBinding gilt, oder legt diesen Wert fest.

Namespace

Ruft den URI ab, der den Speicherort der Spezifikation für die Codierung von Inhalt darstellt, der nicht ausdrücklich durch die Encoding-Eigenschaft festgelegt ist, oder legt diesen URI fest.

Parent

Ruft das übergeordnete Element von ServiceDescriptionFormatExtension ab.

(Geerbt von ServiceDescriptionFormatExtension)
Part

Ruft einen Wert ab, der angibt, für welchen MessagePart innerhalb des XML-Webdiensts das SoapHeaderBinding gilt, oder legt diesen Wert fest.

Required

Ruft einen Wert ab, der angibt, ob die ServiceDescriptionFormatExtension für den Vorgang erforderlich ist, auf den sie verweist.

(Geerbt von ServiceDescriptionFormatExtension)
Use

Gibt an, ob der Header unter Verwendung von Regeln codiert wurde, die durch die Encoding-Eigenschaft angegeben werden, oder ob er in einem bestimmten XML-Schema gekapselt ist.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

(Geerbt von Object)

Gilt für: