Operation Classe

Definizione

Fornisce una definizione astratta di un'azione supportata dal servizio Web XML. La classe non può essere ereditata.

public ref class Operation sealed : System::Web::Services::Description::DocumentableItem
public ref class Operation sealed : System::Web::Services::Description::NamedItem
public sealed class Operation : System.Web.Services.Description.DocumentableItem
[System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")]
public sealed class Operation : System.Web.Services.Description.NamedItem
type Operation = class
    inherit DocumentableItem
[<System.Web.Services.Configuration.XmlFormatExtensionPoint("Extensions")>]
type Operation = class
    inherit NamedItem
Public NotInheritable Class Operation
Inherits DocumentableItem
Public NotInheritable Class Operation
Inherits NamedItem
Ereditarietà
Ereditarietà
Attributi

Esempio

Nell'esempio seguente viene illustrato un uso tipico della Operation classe. L'esempio accetta un ServiceDescriptionPortType oggetto che non supporta il protocollo HTTP POST. Aggiunge un'istanza PortType che supporta POST e scrive un nuovo contratto WSDL.

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

using namespace System;
using namespace System::Web::Services::Description;
using namespace System::Collections;
using namespace System::Xml;
Operation^ CreateOperation( String^ myOperationName, String^ myInputMesg, String^ myOutputMesg )
{
   
   // Create an Operation.
   Operation^ myOperation = gcnew Operation;
   myOperation->Name = myOperationName;
   OperationMessage^ myInput = dynamic_cast<OperationMessage^>(gcnew OperationInput);
   myInput->Message = gcnew XmlQualifiedName( myInputMesg );
   OperationMessage^ myOutput = dynamic_cast<OperationMessage^>(gcnew OperationOutput);
   myOutput->Message = gcnew XmlQualifiedName( myOutputMesg );
   
   // Add messages to the OperationMessageCollection.
   myOperation->Messages->Add( myInput );
   myOperation->Messages->Add( myOutput );
   Console::WriteLine( "Operation name is: {0}", myOperation->Name );
   
   return myOperation;
}

int main()
{
   ServiceDescription^ myDescription = ServiceDescription::Read( "Operation_5_Input_CS.wsdl" );
   
   // Create a 'PortType' object.
   PortType^ myPortType = gcnew PortType;
   myPortType->Name = "OperationServiceHttpPost";
   Operation^ myOperation = CreateOperation( "AddNumbers", "s0:AddNumbersHttpPostIn", "s0:AddNumbersHttpPostOut" );
   myPortType->Operations->Add( myOperation );
   
   // Get the PortType of the Operation. 
   PortType^ myPort = myOperation->PortType;
   Console::WriteLine( "The port type of the operation is: {0}", myPort->Name );
   
   // Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'.
   myDescription->PortTypes->Add( myPortType );
   
   // Write the 'ServiceDescription' as a WSDL file.
   myDescription->Write( "Operation_5_Output_CS.wsdl" );
   Console::WriteLine( "WSDL file with name 'Operation_5_Output_CS.wsdl' file created Successfully" );
}
using System;
using System.Web.Services.Description;
using System.Collections;
using System.Xml;

class MyOperationClass
{
   public static void Main()
   {
      ServiceDescription myDescription = ServiceDescription.Read("Operation_5_Input_CS.wsdl");
      // Create a 'PortType' object.
      PortType myPortType = new PortType();
      myPortType.Name = "OperationServiceHttpPost";
      Operation myOperation = CreateOperation
                         ("AddNumbers","s0:AddNumbersHttpPostIn","s0:AddNumbersHttpPostOut");
      myPortType.Operations.Add(myOperation);
      // Get the PortType of the Operation.
      PortType myPort = myOperation.PortType;
      Console.WriteLine(
         "The port type of the operation is: " + myPort.Name);
      // Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'.
      myDescription.PortTypes.Add(myPortType);

      // Write the 'ServiceDescription' as a WSDL file.
      myDescription.Write("Operation_5_Output_CS.wsdl");
      Console.WriteLine("WSDL file with name 'Operation_5_Output_CS.wsdl' file created Successfully");
   }
   public static Operation CreateOperation(string myOperationName,string myInputMesg,string myOutputMesg)
   {
      // Create an Operation.
      Operation myOperation = new Operation();
      myOperation.Name = myOperationName;
      OperationMessage myInput = (OperationMessage)new OperationInput();
      myInput.Message =  new XmlQualifiedName(myInputMesg);
      OperationMessage myOutput = (OperationMessage)new OperationOutput();
      myOutput.Message = new XmlQualifiedName(myOutputMesg);

      // Add messages to the OperationMessageCollection.
      myOperation.Messages.Add(myInput);
      myOperation.Messages.Add(myOutput);
      Console.WriteLine("Operation name is: " + myOperation.Name);
      return myOperation;
   }
}
Imports System.Web.Services.Description
Imports System.Collections
Imports System.Xml

Class MyOperationClass
   
   Public Shared Sub Main()
      Dim myDescription As ServiceDescription = ServiceDescription.Read("Operation_5_Input_VB.wsdl")
      ' Create a 'PortType' object.
      Dim myPortType As New PortType()
      myPortType.Name = "OperationServiceHttpPost"
      Dim myOperation As Operation = CreateOperation("AddNumbers", "s0:AddNumbersHttpPostIn", _
                                                                     "s0:AddNumbersHttpPostOut")
      myPortType.Operations.Add(myOperation)
      ' Get the PortType of the Operation. 
      Dim myPort As PortType = myOperation.PortType
        Console.WriteLine( _
           "The port type of the operation is: " & myPort.Name)
      ' Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'.
      myDescription.PortTypes.Add(myPortType)
      
      ' Write the 'ServiceDescription' as a WSDL file.
      myDescription.Write("Operation_5_Output_VB.wsdl")
      Console.WriteLine("WSDL file with name 'Operation_5_Output_VB.wsdl'" + _ 
                           "file created Successfully")
   End Sub
   
   Public Shared Function CreateOperation(myOperationName As String, myInputMesg As String, _
                                                         myOutputMesg As String) As Operation
      ' Create an Operation.
      Dim myOperation As New Operation()
      myOperation.Name = myOperationName
      Dim myInput As OperationMessage = _
         CType(New OperationInput(), OperationMessage)
      myInput.Message = New XmlQualifiedName(myInputMesg)
      Dim myOutput As OperationMessage = _
         CType(New OperationOutput(), OperationMessage)
      myOutput.Message = New XmlQualifiedName(myOutputMesg)

      ' Add messages to the OperationMessageCollection.
      myOperation.Messages.Add(myInput)
      myOperation.Messages.Add(myOutput)
      Console.WriteLine("Operation name is: " & myOperation.Name)
      Return myOperation
   End Function 'CreateOperation 
End Class

Commenti

La Operation classe corrisponde all'elemento WSDL (Web Services Description Language) operation racchiuso dall'elemento portType . Per altre informazioni su WSDL, vedere la specifica WSDL.

Costruttori

Operation()

Inizializza una nuova istanza della classe Operation.

Proprietà

Documentation

Ottiene o imposta la documentazione di testo per l'istanza di DocumentableItem.

(Ereditato da DocumentableItem)
DocumentationElement

Ottiene o imposta l'elemento di documentazione di DocumentableItem.

(Ereditato da DocumentableItem)
ExtensibleAttributes

Ottiene o imposta una matrice di tipo XmlAttribute che rappresenta le estensioni dell'attributo di WSDL per la conformità a Web Services Interoperability (WS-I) Basic Profile 1.1.

(Ereditato da DocumentableItem)
Extensions

Ottiene l'oggetto ServiceDescriptionFormatExtensionCollection associato a questo oggetto Operation.

Extensions

Ottiene l'oggetto ServiceDescriptionFormatExtensionCollection associato a questo oggetto DocumentableItem.

(Ereditato da DocumentableItem)
Faults

Ottiene l'insieme di errori o messaggi di errore definiti dall'oggetto Operation corrente.

Messages

Ottiene l'insieme di istanze della classe Message definita dall'oggetto Operation corrente.

Name

Ottiene o imposta il nome di Operation.

Name

Ottiene o imposta il nome dell'elemento.

(Ereditato da NamedItem)
Namespaces

Ottiene o imposta il dizionario dei prefissi degli spazi dei nomi e degli spazi dei nomi utilizzato per conservare i prefissi degli spazi dei nomi e gli spazi dei nomi quando viene costruito un oggetto ServiceDescription.

(Ereditato da DocumentableItem)
ParameterOrder

Ottiene o imposta una matrice degli elementi contenuti nella proprietà ParameterOrderString.

ParameterOrderString

Ottiene o imposta una firma RPC (Remote Procedure Call) facoltativa che ordina la specifica per operazioni di richiesta-risposta o sollecito-risposta.

PortType

Ottiene l'oggetto PortType di cui Operation è membro.

Metodi

Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene l'oggetto Type dell'istanza corrente.

(Ereditato da Object)
IsBoundBy(OperationBinding)

Restituisce un valore che indica se l'oggetto OperationBinding specificato corrisponde all'oggetto Operation.

MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

(Ereditato da Object)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a

Vedi anche