OperationMessage 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
表示 XML Web Service 的動作傳遞的訊息類型。
public ref class OperationMessage abstract : System::Web::Services::Description::DocumentableItem
public ref class OperationMessage abstract : System::Web::Services::Description::NamedItem
public abstract class OperationMessage : System.Web.Services.Description.DocumentableItem
public abstract class OperationMessage : System.Web.Services.Description.NamedItem
type OperationMessage = class
inherit DocumentableItem
type OperationMessage = class
inherit NamedItem
Public MustInherit Class OperationMessage
Inherits DocumentableItem
Public MustInherit Class OperationMessage
Inherits NamedItem
- 繼承
- 繼承
- 衍生
範例
#using <System.dll>
#using <System.Web.Services.dll>
#using <System.Xml.dll>
using namespace System;
using namespace System::Xml;
using namespace System::Web::Services;
using namespace System::Web::Services::Description;
int main()
{
try
{
ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" );
PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes;
// Get the OperationCollection for the SOAP protocol.
OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations;
// Get the OperationMessageCollection for the Add operation.
OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages;
OperationMessage^ myInputOperationMessage = (OperationMessage^)(gcnew OperationInput);
XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace );
myInputOperationMessage->Message = myXmlQualifiedName;
myOperationMessageCollection->Insert( 0, myInputOperationMessage );
// Display the operation name of the InputMessage.
Console::WriteLine( "The operation name is {0}", myInputOperationMessage->Operation->Name );
// Add the OperationMessage to the collection.
myDescription->Write( "MathService_new_cs.wsdl" );
}
catch ( Exception^ e )
{
Console::WriteLine( "Exception caught!!!" );
Console::WriteLine( "Source : {0}", e->Source );
Console::WriteLine( "Message : {0}", e->Message );
}
}
using System;
using System.Xml;
using System.Web.Services;
using System.Web.Services.Description;
class MyOperationMessageSample
{
static void Main()
{
try
{
ServiceDescription myDescription =
ServiceDescription.Read("MathService_input_cs.wsdl");
PortTypeCollection myPortTypeCollection =
myDescription.PortTypes;
// Get the OperationCollection for the SOAP protocol.
OperationCollection myOperationCollection =
myPortTypeCollection[0].Operations;
// Get the OperationMessageCollection for the Add operation.
OperationMessageCollection myOperationMessageCollection =
myOperationCollection[0].Messages;
OperationMessage myInputOperationMessage =
(OperationMessage) new OperationInput();
XmlQualifiedName myXmlQualifiedName = new XmlQualifiedName(
"AddSoapIn", myDescription.TargetNamespace);
myInputOperationMessage.Message = myXmlQualifiedName;
myOperationMessageCollection.Insert(0, myInputOperationMessage);
// Display the operation name of the InputMessage.
Console.WriteLine("The operation name is " +
myInputOperationMessage.Operation.Name);
// Add the OperationMessage to the collection.
myDescription.Write("MathService_new_cs.wsdl");
}
catch(Exception e)
{
Console.WriteLine("Exception caught!!!");
Console.WriteLine("Source : " + e.Source);
Console.WriteLine("Message : " + e.Message);
}
}
}
Imports System.Xml
Imports System.Web.Services
Imports System.Web.Services.Description
Class MyOperationMessageSample
Shared Sub Main()
Try
Dim myDescription As ServiceDescription = _
ServiceDescription.Read("MathService_input_vb.wsdl")
Dim myPortTypeCollection As PortTypeCollection = _
myDescription.PortTypes
' Get the OperationCollection for the SOAP protocol.
Dim myOperationCollection As OperationCollection = _
myPortTypeCollection(0).Operations
' Get the OperationMessageCollection for the Add operation.
Dim myOperationMessageCollection As OperationMessageCollection = _
myOperationCollection(0).Messages
Dim myInputOperationMessage As OperationMessage = _
CType(New OperationInput(), OperationMessage)
Dim myXmlQualifiedName As New XmlQualifiedName("AddSoapIn", _
myDescription.TargetNamespace)
myInputOperationMessage.Message = myXmlQualifiedName
myOperationMessageCollection.Insert(0, myInputOperationMessage)
' Display the operation name of the InputMessage.
Console.WriteLine("The operation name is " & _
myInputOperationMessage.Operation.Name)
' Add the OperationMessage to the collection.
myDescription.Write("MathService_new_vb.wsdl")
Catch e As Exception
Console.WriteLine("Exception caught!!!")
Console.WriteLine("Source : " & e.Source.ToString())
Console.WriteLine("Message : " & e.Message.ToString())
End Try
End Sub
End Class
備註
此類別可作為下列類別的基類:
建構函式
OperationMessage() |
初始化 OperationMessage 類別的新執行個體。 |
屬性
Documentation |
取得或設定 DocumentableItem 的執行個體的文字文件。 (繼承來源 DocumentableItem) |
DocumentationElement |
取得或設定 DocumentableItem 的文件項目。 (繼承來源 DocumentableItem) |
ExtensibleAttributes |
取得或設定型別 XmlAttribute 的陣列,表示符合 Web 服務互通性 (WS-I) Basic Profile 1.1 的 WSDL 屬性擴充。 (繼承來源 DocumentableItem) |
Extensions |
取得與這個 ServiceDescriptionFormatExtensionCollection 關聯的 DocumentableItem。 (繼承來源 DocumentableItem) |
Message |
取得或設定通訊中資料的抽象型別定義。 |
Name |
取得或設定 OperationMessage 的名稱。 |
Name |
取得或設定項目的名稱。 (繼承來源 NamedItem) |
Namespaces |
取得或設定命名空間前置詞和命名空間的字典,用於在建構 ServiceDescription 物件時保留命名空間前置詞和命名空間。 (繼承來源 DocumentableItem) |
Operation |
取得 Operation,OperationMessage 為其中的成員。 |
方法
Equals(Object) |
判斷指定的物件是否等於目前的物件。 (繼承來源 Object) |
GetHashCode() |
做為預設雜湊函式。 (繼承來源 Object) |
GetType() |
取得目前執行個體的 Type。 (繼承來源 Object) |
MemberwiseClone() |
建立目前 Object 的淺層複製。 (繼承來源 Object) |
ToString() |
傳回代表目前物件的字串。 (繼承來源 Object) |