Operation Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menyediakan definisi abstrak dari tindakan yang didukung oleh layanan Web XML. Kelas ini tidak dapat diwariskan.
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
- Warisan
- Warisan
- Atribut
Contoh
Contoh berikut menunjukkan penggunaan Operation umum kelas. Contoh mengambil ServiceDescription yang tidak memiliki PortType yang mendukung protokol HTTP POST. Ini menambahkan instans PortType yang mendukung POST, dan menulis kontrak WSDL baru.
#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
Keterangan
Kelas Operation sesuai dengan elemen Web Services Description Language (WSDL) operation yang diapit oleh portType elemen . Untuk informasi selengkapnya tentang WSDL, lihat spesifikasi WSDL .
Konstruktor
| Nama | Deskripsi |
|---|---|
| Operation() |
Menginisialisasi instans baru dari kelas Operation. |
Properti
| Nama | Deskripsi |
|---|---|
| Documentation |
Mendapatkan atau mengatur dokumentasi teks untuk instans DocumentableItem. (Diperoleh dari DocumentableItem) |
| DocumentationElement |
Mendapatkan atau mengatur elemen dokumentasi untuk DocumentableItem. (Diperoleh dari DocumentableItem) |
| ExtensibleAttributes |
Mendapatkan atau mengatur array jenis XmlAttribute yang mewakili ekstensi atribut WSDL untuk mematuhi Interoperabilitas Layanan Web (WS-I) Profil Dasar 1.1. (Diperoleh dari DocumentableItem) |
| Extensions |
Mendapatkan yang ServiceDescriptionFormatExtensionCollection terkait dengan ini Operation. |
| Faults |
Mendapatkan kumpulan kesalahan, atau pesan kesalahan, yang ditentukan oleh .Operation |
| Messages |
Mendapatkan koleksi instans kelas yang Message ditentukan oleh .Operation |
| Name |
Mendapatkan atau menetapkan nama Operation. |
| Name |
Mendapatkan atau mengatur nama item. (Diperoleh dari NamedItem) |
| Namespaces |
Mendapatkan atau mengatur kamus awalan namespace layanan dan namespace yang digunakan untuk mempertahankan awalan namespace layanan dan namespace saat ServiceDescription objek dibangun. (Diperoleh dari DocumentableItem) |
| ParameterOrder |
Mendapatkan atau mengatur array elemen yang terkandung dalam ParameterOrderString. |
| ParameterOrderString |
Mendapatkan atau mengatur tanda tangan Panggilan Prosedur Jarak Jauh (RPC) opsional yang memesan spesifikasi untuk operasi respons permintaan atau respons ajakan. |
| PortType |
Metode
| Nama | Deskripsi |
|---|---|
| Equals(Object) |
Menentukan apakah objek yang ditentukan sama dengan objek saat ini. (Diperoleh dari Object) |
| GetHashCode() |
Berfungsi sebagai fungsi hash default. (Diperoleh dari Object) |
| GetType() |
Mendapatkan Type instans saat ini. (Diperoleh dari Object) |
| IsBoundBy(OperationBinding) |
Mengembalikan nilai yang menunjukkan apakah yang ditentukan OperationBinding cocok dengan Operation. |
| MemberwiseClone() |
Membuat salinan dangkal dari Objectsaat ini. (Diperoleh dari Object) |
| ToString() |
Mengembalikan string yang mewakili objek saat ini. (Diperoleh dari Object) |