WCF消息契约真实示例

WCF消息契约真实示例,wcf,Wcf,我在互联网上搜索了多个资源,但我所遇到的只是“Hello World”和“Calculator”之类的例子来解释WCF中的消息契约。我想知道消息契约在实际企业应用程序中的实际使用情况,以及什么时候应该优先于数据契约。任何关于这方面的帮助都将不胜感激。一个真实的场景是,例如,当一个Java客户机有一个不变的WSDL文件时(技术原因)。因此Java客户机有一个固定的WSDL文件。然后web服务(.net)必须为该方法提供确切的名称、命名空间、操作和消息字符串 Java客户端示例: <op

我在互联网上搜索了多个资源,但我所遇到的只是“Hello World”和“Calculator”之类的例子来解释WCF中的消息契约。我想知道消息契约在实际企业应用程序中的实际使用情况,以及什么时候应该优先于数据契约。任何关于这方面的帮助都将不胜感激。

一个真实的场景是,例如,当一个Java客户机有一个不变的WSDL文件时(技术原因)。因此Java客户机有一个固定的WSDL文件。然后web服务(.net)必须为该方法提供确切的名称、命名空间、操作和消息字符串

Java客户端示例:

   <operation name="remove">
       <input wsam:Action="remove" message="tns:remove"/>
       <output wsam:Action="removeResponse" message="tns:removeResponse"/>
   </operation>

默认值为自动生成的web服务,如下所示:

<wsdl:operation name="remove">
  <wsdl:input message="tns:IService1_remove_InputMessage" wsaw:Action="http://tempuri.org/IService1/remove"/>
  <wsdl:output message="tns:IService1_remove_OutputMessage" wsaw:Action="http://tempuri.org/IService1/removeResponse"
</wsdl:operation>


最好的办法是尝试实施它。是一个非常真实的例子,可能是
<OperationContractAttribute(Action:="remove", name:="remove" ReplyAction:="removeResponse")> _
 Function remove(key As string) As Boolean
<wsdl:operation name="remove">
<wsdl:input message="tns:IService1_remove_InputMessage" wsaw:Action="remove"/>
<wsdl:output message="tns:IService1_remove_OutputMessage" wsaw:Action="removeResponse"
</wsdl:operation>
<OperationContractAttribute(Action:="remove", name:="remove" ReplyAction:="removeResponse")> _
 Function remove(key As remove) As removeResponse
 <MessageContract()> _
    Public Class removeResponse

    Private return1 As Boolean()

    <DataMember(Name:="return")> _
    Public Property returnP() As Boolean ()
        Get
            Return Me.return1
        End Get
        Set(ByVal value As Boolean ())
            Me.return1 = value
        End Set
    End Property

End Class

<MessageContract()> _
Public Class remove

    Private key1 As String()

    <DataMember(Name:="key")> _
    Public Property keyP() As String ()
        Get
            Return Me.key1
        End Get
        Set(ByVal value As String ())
            Me.key1 = value
        End Set
    End Property

End Class
<wsdl:operation name="remove">
<wsdl:input message="remove" wsaw:Action="remove"/>
<wsdl:output message="removeResponse" wsaw:Action="removeResponse"
</wsdl:operation>