WCF代理中的Action和ReplyAction

Amu*_*tha 1 wcf contracts

OperationContract属性中Action和ReplyAction的用途是什么?

Nix*_*Nix 5

Action为您的服务方法定义了肥皂操作的输入uri.

Reply Action定义服务方法的输出uri.

它们基本上用于为两者定制uri.见下文.

 [ServiceContract]
 public partial interface IServiceContract
 {
    [OperationContract(
            Action = "http://mynamspace/v1/IServiceContract/Input/ServiceMethod",
            ReplyAction = "http://mynamspace/v1/IServiceContract/Output/ServiceMethod")]
    SomeResponseType ServiceMethod(SomeRequestType x);
Run Code Online (Sandbox Code Playgroud)

在你的wsdl你会看到

 <wsdl:portType name="IServiceContract">
    <wsdl:operation name="ServiceMethod">
    <wsdl:input wsaw:Action="http://mynamspace/v1/IServiceContract/Input/ServiceMethod" name="SomeRequestType" message="tns:SomeRequestType " /> 
    <wsdl:output wsaw:Action="http://mynamspace/v1/IServiceContract/Output/ServiceMethod" name="SomeResponseType" message="tns:SomeResponseType " /> 
Run Code Online (Sandbox Code Playgroud)

有道理?