OperationMessage 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示 XML Web services 的操作所传递的消息类型。
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) 基本概要 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) |