Freigeben über


MessageBinding Klasse

Definition

Beschreibt, wie abstrakter Inhalt einem konkreten Format zugeordnet wird.

public ref class MessageBinding abstract : System::Web::Services::Description::DocumentableItem
public ref class MessageBinding abstract : System::Web::Services::Description::NamedItem
public abstract class MessageBinding : System.Web.Services.Description.DocumentableItem
public abstract class MessageBinding : System.Web.Services.Description.NamedItem
type MessageBinding = class
    inherit DocumentableItem
type MessageBinding = class
    inherit NamedItem
Public MustInherit Class MessageBinding
Inherits DocumentableItem
Public MustInherit Class MessageBinding
Inherits NamedItem
Vererbung
MessageBinding
Vererbung
Abgeleitet

Beispiele

Im folgenden Beispiel wird eine typische Verwendung der MessageBinding Klasse veranschaulicht.

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

using namespace System;
using namespace System::Web::Services::Description;
MessageBinding^ CreateInputOutputBinding( String^ myBindName, bool isInputBinding )
{
   
   // Value isInputBinding = true ---> return type = InputBinding.
   // Value isInputBinding = false --> return type = OutputBinding.
   MessageBinding^ myMessageBinding = nullptr;
   switch ( isInputBinding )
   {
      case true:
         myMessageBinding = gcnew InputBinding;
         Console::WriteLine( "Added an InputBinding" );
         break;

      case false:
         myMessageBinding = gcnew OutputBinding;
         Console::WriteLine( "Added an OutputBinding" );
         break;
   }
   myMessageBinding->Name = myBindName;
   SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
   mySoapBodyBinding->Use = SoapBindingUse::Literal;
   myMessageBinding->Extensions->Add( mySoapBodyBinding );
   Console::WriteLine( "Added extensibility element of type : {0}", mySoapBodyBinding->GetType() );

   return myMessageBinding;
}


// Used to create OperationBinding instances within Binding.
OperationBinding^ CreateOperationBinding( String^ myOperation, String^ targetNamespace )
{
   // Create OperationBinding for Operation.
   OperationBinding^ myOperationBinding = gcnew OperationBinding;
   myOperationBinding->Name = myOperation;

   // Create InputBinding for operation.
   InputBinding^ myInputBinding = dynamic_cast<InputBinding^>(CreateInputOutputBinding( nullptr, true ));

   // Create OutputBinding for operation.
   OutputBinding^ myOutputBinding = dynamic_cast<OutputBinding^>(CreateInputOutputBinding( nullptr, false ));

   // Add InputBinding and OutputBinding to OperationBinding.
   myOperationBinding->Input = myInputBinding;
   myOperationBinding->Output = myOutputBinding;

   // Create an extensibility element for SoapOperationBinding.
   SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
   mySoapOperationBinding->Style = SoapBindingStyle::Document;
   mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, myOperation );

   // Add the extensibility element SoapOperationBinding to OperationBinding.
   myOperationBinding->Extensions->Add( mySoapOperationBinding );
   return myOperationBinding;
}

int main()
{
   /* OperationBinding* addOperationBinding = */
   CreateOperationBinding( "Add", "http://tempuri.org/" );
}
using System;
using System.Web.Services.Description;
class MyClass
{
   public static void Main()
   {
   OperationBinding addOperationBinding =
      CreateOperationBinding("Add","http://tempuri.org/");
   }

   public static MessageBinding CreateInputOutputBinding(string myBindName,
      bool isInputBinding)
   {

     // Value isInputBinding = true ---> return type = InputBinding.
     // Value isInputBinding = false --> return type = OutputBinding.
     MessageBinding myMessageBinding = null;
      switch(isInputBinding)
      {
         case true:
            myMessageBinding = new InputBinding();
            Console.WriteLine("Added an InputBinding");
            break;
         case false:
            myMessageBinding = new OutputBinding();
            Console.WriteLine("Added an OutputBinding");
            break;
      }
      myMessageBinding.Name = myBindName;
      SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
      mySoapBodyBinding.Use = SoapBindingUse.Literal;
      myMessageBinding.Extensions.Add(mySoapBodyBinding);
      Console.WriteLine("Added extensibility element of type : " +
         mySoapBodyBinding.GetType());
      return myMessageBinding;
   }

   // Used to create OperationBinding instances within Binding.
   public static OperationBinding CreateOperationBinding(
      string myOperation,string targetNamespace)
   {
      // Create OperationBinding for Operation.
      OperationBinding myOperationBinding = new OperationBinding();
      myOperationBinding.Name = myOperation;

      // Create InputBinding for operation.
      InputBinding myInputBinding =
        (InputBinding)CreateInputOutputBinding(null,true);

      // Create OutputBinding for operation.
      OutputBinding myOutputBinding =
         (OutputBinding)CreateInputOutputBinding(null,false);

      // Add InputBinding and OutputBinding to OperationBinding.
      myOperationBinding.Input = myInputBinding;
      myOperationBinding.Output = myOutputBinding;

      // Create an extensibility element for SoapOperationBinding.
      SoapOperationBinding mySoapOperationBinding = new SoapOperationBinding();
      mySoapOperationBinding.Style = SoapBindingStyle.Document;
      mySoapOperationBinding.SoapAction = targetNamespace + myOperation;

      // Add the extensibility element SoapOperationBinding to OperationBinding.
      myOperationBinding.Extensions.Add(mySoapOperationBinding);
      return myOperationBinding;
   }
}
Imports System.Web.Services.Description

Class MyClass1

   Public Shared Sub Main()
      Dim addOperationBinding As OperationBinding = _
         CreateOperationBinding("Add", "http://tempuri.org/")
   End Sub

   Public Shared Function CreateInputOutputBinding(myBindName As String, _
      isInputBinding As Boolean) As MessageBinding
      ' Value isInputBinding = true ---> return type = InputBinding.
      ' Value isInputBinding = false --> return type = OutputBinding.
      Dim myMessageBinding As MessageBinding = Nothing
      Select Case isInputBinding
         Case True
            myMessageBinding = New InputBinding()
            Console.WriteLine("Added an InputBinding")
         Case False
            myMessageBinding = New OutputBinding()
            Console.WriteLine("Added an OutputBinding")
      End Select
      myMessageBinding.Name = myBindName
      Dim mySoapBodyBinding As New SoapBodyBinding()
      mySoapBodyBinding.Use = SoapBindingUse.Literal
      myMessageBinding.Extensions.Add(mySoapBodyBinding)
      Console.WriteLine("Added extensibility element of type: " & _
         mySoapBodyBinding.GetType().ToString())
      Return myMessageBinding
   End Function 'CreateInputOutputBinding

   ' Used to create OperationBinding instances within Binding.
   Public Shared Function CreateOperationBinding(myOperation As String, _
      targetNamespace As String) As OperationBinding

      ' Create OperationBinding for operation.
      Dim myOperationBinding As New OperationBinding()
      myOperationBinding.Name = myOperation

      ' Create InputBinding for operation.
      Dim myInputBinding As InputBinding = _
         CType(CreateInputOutputBinding(Nothing, True), InputBinding)
      ' Create OutputBinding for operation.
      Dim myOutputBinding As OutputBinding = _
         CType(CreateInputOutputBinding(Nothing, False), OutputBinding)

      ' Add InputBinding and OutputBinding to OperationBinding.
      myOperationBinding.Input = myInputBinding
      myOperationBinding.Output = myOutputBinding

      ' Create an extensibility element for SoapOperationBinding.
      Dim mySoapOperationBinding As New SoapOperationBinding()
      mySoapOperationBinding.Style = SoapBindingStyle.Document
      mySoapOperationBinding.SoapAction = targetNamespace + myOperation

      ' Add the extensibility element SoapOperationBinding to OperationBinding.
      myOperationBinding.Extensions.Add(mySoapOperationBinding)
      Return myOperationBinding
   End Function 'CreateOperationBinding
End Class

Hinweise

Diese abstrakte Klasse bildet die Basisklasse für die folgenden Klassen:

Konstruktoren

MessageBinding()

Initialisiert eine neue Instanz der MessageBinding-Klasse.

Eigenschaften

Documentation

Ruft die Textdokumentation für die Instanz von DocumentableItem ab oder legt diese fest.

(Geerbt von DocumentableItem)
DocumentationElement

Ruft das Dokumentationselement für das DocumentableItem ab oder legt dieses fest.

(Geerbt von DocumentableItem)
ExtensibleAttributes

Ruft ein Array vom Typ XmlAttribute ab, das Attributerweiterungen von WSDL darstellt, um dem WS-I-Basisprofil 1.1 (Web Services Interoperability) zu entsprechen, oder legt dieses fest.

(Geerbt von DocumentableItem)
Extensions

Ruft den ServiceDescriptionFormatExtensionCollection ab, der dem DocumentableItem zugeordnet ist.

Extensions

Ruft den diesem ServiceDescriptionFormatExtensionCollection zugeordneten DocumentableItem ab.

(Geerbt von DocumentableItem)
Name

Ruft den Namen der MessageBinding ab oder legt diesen fest.

Name

Ruft den Namen des Elements ab oder legt diesen fest.

(Geerbt von NamedItem)
Namespaces

Ruft das Wörterbuch der Namespacepräfixe und Namespaces ab, die verwendet werden, um die Namespacepräfixe und Namespaces beim Erstellen eines ServiceDescription-Objekts beizubehalten.

(Geerbt von DocumentableItem)
OperationBinding

Ruft das OperationBinding ab, zu dessen Membern das aktuelle MessageBinding gehört.

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