Operation Clase

Definición

Proporciona una definición abstracta de una acción admitida por el servicio Web XML. Esta clase no puede heredarse.

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
Herencia
Herencia
Atributos

Ejemplos

En el ejemplo siguiente se muestra un uso típico de la Operation clase . En el ejemplo se toma un ServiceDescription que no tiene un PortType que admita el protocolo HTTP POST. Agrega una PortType instancia que admite POST y escribe un nuevo 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

Comentarios

La Operation clase corresponde al elemento Lenguaje de descripción de servicios web (WSDL) operation incluido en el portType elemento . Para obtener más información sobre WSDL, consulte la especificación WSDL.

Constructores

Operation()

Inicializa una nueva instancia de la clase Operation.

Propiedades

Documentation

Obtiene o establece la documentación de texto de la instancia de DocumentableItem.

(Heredado de DocumentableItem)
DocumentationElement

Obtiene o establece el elemento de documentación para el objeto DocumentableItem.

(Heredado de DocumentableItem)
ExtensibleAttributes

Obtiene o establece una matriz de tipo XmlAttribute que representa extensiones de atributo de WSDL que se ajustan al perfil básico de interoperabilidad de los servicios Web (WS-I) 1.1.

(Heredado de DocumentableItem)
Extensions

Obtiene el objeto ServiceDescriptionFormatExtensionCollection asociado a Operation.

Extensions

Obtiene el objeto ServiceDescriptionFormatExtensionCollection asociado a DocumentableItem.

(Heredado de DocumentableItem)
Faults

Obtiene la colección de errores o mensajes de error definidos por el objeto Operation actual.

Messages

Obtiene la colección de instancias de la clase Message definida por el objeto Operation actual.

Name

Obtiene o establece el nombre de Operation.

Name

Obtiene o establece el nombre del elemento.

(Heredado de NamedItem)
Namespaces

Obtiene o establece el diccionario de prefijos de espacio de nombres y los espacios de nombres utilizados para conservar los prefijos de espacio de nombres y los espacios de nombres cuando se construye un objeto ServiceDescription.

(Heredado de DocumentableItem)
ParameterOrder

Obtiene o establece una matriz de los elementos incluidos en ParameterOrderString.

ParameterOrderString

Obtiene o establece una firma de llamada al procedimiento remoto (RPC) opcional que ordena la especificación de las operaciones de pares petición-respuesta o solicitud-respuesta.

PortType

Obtiene el objeto PortType del que forma parte Operation.

Métodos

Equals(Object)

Determina si el objeto especificado es igual que el objeto actual.

(Heredado de Object)
GetHashCode()

Sirve como la función hash predeterminada.

(Heredado de Object)
GetType()

Obtiene el Type de la instancia actual.

(Heredado de Object)
IsBoundBy(OperationBinding)

Devuelve un valor que indica si el ensamblado especificado OperationBinding coincide con el ensamblado Operation.

MemberwiseClone()

Crea una copia superficial del Object actual.

(Heredado de Object)
ToString()

Devuelve una cadena que representa el objeto actual.

(Heredado de Object)

Se aplica a

Consulte también