Operation Classe

Definição

Fornece uma definição abstrata de uma ação compatível com o serviço Web XML. Essa classe não pode ser herdada.

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
Herança
Herança
Atributos

Exemplos

O exemplo a seguir demonstra um uso típico da Operation classe. O exemplo usa um ServiceDescription que não tem um PortType que dá suporte ao protocolo HTTP POST. Ele adiciona uma PortType instância que dá suporte ao POST e grava um novo contrato 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

Comentários

A Operation classe corresponde ao elemento WSDL (Linguagem de Descrição dos Serviços Web) operation colocado pelo portType elemento. Para obter mais informações sobre WSDL, confira a especificação WSDL.

Construtores

Operation()

Inicializa uma nova instância da classe Operation.

Propriedades

Documentation

Obtém ou define a documentação de texto para a instância do DocumentableItem.

(Herdado de DocumentableItem)
DocumentationElement

Obtém ou define o elemento de documentação para o DocumentableItem.

(Herdado de DocumentableItem)
ExtensibleAttributes

Obtém ou define uma matriz do tipo XmlAttribute que representa extensões de atributo do WSDL para estarem em conformidade com o Perfil Básico 1.1 WS-I (Interoperabilidade de Serviços Web).

(Herdado de DocumentableItem)
Extensions

Obtém o ServiceDescriptionFormatExtensionCollection associado a este Operation.

Extensions

Obtém o ServiceDescriptionFormatExtensionCollection associado a este DocumentableItem.

(Herdado de DocumentableItem)
Faults

Obtém a coleção de falhas ou mensagens de erro definidas pelo atual Operation.

Messages

Obtém a coleção de instâncias da classe Message definidas pelo Operation atual.

Name

Obtém ou define o nome de Operation.

Name

Obtém ou define o nome do item.

(Herdado de NamedItem)
Namespaces

Obtém ou define o dicionário de prefixos de namespace e os namespaces usados para preservar prefixos de namespace e namespaces quando um objeto ServiceDescription é construído.

(Herdado de DocumentableItem)
ParameterOrder

Obtém ou define uma matriz de elementos contidos no ParameterOrderString.

ParameterOrderString

Obtém ou define uma assinatura RPC (Chamada de Procedimento Remoto) opcional que solicita a especificação para operações de solicitação-resposta (request-response) ou solicitação-resposta (solicit-response).

PortType

Obtém o PortType do qual o Operation é um membro.

Métodos

Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.

(Herdado de Object)
GetHashCode()

Serve como a função de hash padrão.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
IsBoundBy(OperationBinding)

Retorna um valor que indica se o OperationBinding especificado combina com o Operation.

MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Aplica-se a

Confira também