Partager via


Binding.Operations Propriété

Définition

Obtient la collection de spécifications pour des formats de données et des protocoles de message utilisés dans l'action prise en charge par le service Web XML.

public:
 property System::Web::Services::Description::OperationBindingCollection ^ Operations { System::Web::Services::Description::OperationBindingCollection ^ get(); };
public System.Web.Services.Description.OperationBindingCollection Operations { get; }
member this.Operations : System.Web.Services.Description.OperationBindingCollection
Public ReadOnly Property Operations As OperationBindingCollection

Valeur de propriété

OperationBindingCollection

Objet OperationBindingCollection qui contient la collection de spécifications pour des formats de données et des protocoles de message utilisés dans l'action prise en charge par le service Web XML.

Exemples

L’exemple suivant illustre une utilisation classique de la Operations propriété.

// Create OperationBindings for each of the operations defined in asmx file.
OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace );
myBinding->Operations->Add( addOperationBinding );
OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace );
myBinding->Operations->Add( subtractOperationBinding );
OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace );
myBinding->Operations->Add( multiplyOperationBinding );
OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace );
myBinding->Operations->Add( divideOperationBinding );
// Create OperationBindings for each of the operations defined in asmx file.
OperationBinding addOperationBinding = CreateOperationBinding("Add",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(addOperationBinding);
OperationBinding subtractOperationBinding = CreateOperationBinding("Subtract",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(subtractOperationBinding);
OperationBinding multiplyOperationBinding = CreateOperationBinding("Multiply",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(multiplyOperationBinding);
OperationBinding divideOperationBinding = CreateOperationBinding("Divide",myServiceDescription.TargetNamespace);
myBinding.Operations.Add(divideOperationBinding);
' Create OperationBindings for each of the operations defined in asmx file.
Dim addOperationBinding As OperationBinding = CreateOperationBinding("Add", myServiceDescription.TargetNamespace)
myBinding.Operations.Add(addOperationBinding)
Dim subtractOperationBinding As OperationBinding = CreateOperationBinding("Subtract", myServiceDescription.TargetNamespace)
myBinding.Operations.Add(subtractOperationBinding)
Dim multiplyOperationBinding As OperationBinding = CreateOperationBinding("Multiply", myServiceDescription.TargetNamespace)
myBinding.Operations.Add(multiplyOperationBinding)
Dim divideOperationBinding As OperationBinding = CreateOperationBinding("Divide", myServiceDescription.TargetNamespace)
myBinding.Operations.Add(divideOperationBinding)
   // Used to create OperationBinding instances within 'Binding'.
public:
   static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace )
   {
      // Create OperationBinding instance for operation.
      OperationBinding^ myOperationBinding = gcnew OperationBinding;
      myOperationBinding->Name = operation;
      // Create InputBinding for operation.
      InputBinding^ myInputBinding = gcnew InputBinding;
      SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding;
      mySoapBodyBinding->Use = SoapBindingUse::Literal;
      myInputBinding->Extensions->Add( mySoapBodyBinding );
      // Create OutputBinding for operation.
      OutputBinding^ myOutputBinding = gcnew OutputBinding;
      myOutputBinding->Extensions->Add( mySoapBodyBinding );
      // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
      myOperationBinding->Input = myInputBinding;
      myOperationBinding->Output = myOutputBinding;
      // Create extensibility element for 'SoapOperationBinding'.
      SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding;
      mySoapOperationBinding->Style = SoapBindingStyle::Document;
      mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation );
      // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'.
      myOperationBinding->Extensions->Add( mySoapOperationBinding );
      return myOperationBinding;
   }
// Used to create OperationBinding instances within 'Binding'.
public static OperationBinding CreateOperationBinding(string operation,string targetNamespace)
{
   // Create OperationBinding instance for operation.
   OperationBinding myOperationBinding = new OperationBinding();
   myOperationBinding.Name = operation;
   // Create InputBinding for operation.
   InputBinding myInputBinding = new InputBinding();
   SoapBodyBinding mySoapBodyBinding = new SoapBodyBinding();
   mySoapBodyBinding.Use = SoapBindingUse.Literal;
   myInputBinding.Extensions.Add(mySoapBodyBinding);
   // Create OutputBinding for operation.
   OutputBinding myOutputBinding = new OutputBinding();
   myOutputBinding.Extensions.Add(mySoapBodyBinding);
   // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'.
   myOperationBinding.Input = myInputBinding;
   myOperationBinding.Output = myOutputBinding;
   // Create extensibility element for 'SoapOperationBinding'.
   SoapOperationBinding mySoapOperationBinding = new SoapOperationBinding();
   mySoapOperationBinding.Style = SoapBindingStyle.Document;
   mySoapOperationBinding.SoapAction = targetNamespace + operation;
   // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'.
   myOperationBinding.Extensions.Add(mySoapOperationBinding);
   return myOperationBinding;
}
' Used to create OperationBinding instances within 'Binding'.
Public Shared Function CreateOperationBinding(operation As String, targetNamespace As String) As OperationBinding
   ' Create OperationBinding instance for operation.
   Dim myOperationBinding As New OperationBinding()
   myOperationBinding.Name = operation
   ' Create InputBinding for operation.
   Dim myInputBinding As New InputBinding()
   Dim mySoapBodyBinding As New SoapBodyBinding()
   mySoapBodyBinding.Use = SoapBindingUse.Literal
   myInputBinding.Extensions.Add(mySoapBodyBinding)
   ' Create OutputBinding for operation.
   Dim myOutputBinding As New OutputBinding()
   myOutputBinding.Extensions.Add(mySoapBodyBinding)
   ' Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. 
   myOperationBinding.Input = myInputBinding
   myOperationBinding.Output = myOutputBinding
   ' Create extensibility element for 'SoapOperationBinding'.
   Dim mySoapOperationBinding As New SoapOperationBinding()
   mySoapOperationBinding.Style = SoapBindingStyle.Document
   mySoapOperationBinding.SoapAction = targetNamespace + operation
   ' Add extensibility element 'SoapOperationBinding' to 'OperationBinding'.
   myOperationBinding.Extensions.Add(mySoapOperationBinding)
   Return myOperationBinding
End Function 'CreateOperationBinding

S’applique à