OperationContract属性中Action和ReplyAction的用途是什么?
答案 0 :(得分:5)
Action为您的服务方法定义了肥皂操作的输入uri。
回复操作定义服务方法的输出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);
在你的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 " />
那有道理吗?
答案 1 :(得分:1)
用于WS寻址。
WS-Addressing简介:http://www.fpml.org/_wgmail/_bpwgmail/pdfdz3oYx1M9e.pdf http://www.w3.org/Submission/ws-addressing/
查看回复肥皂消息: http://msdn.microsoft.com/en-us/library/system.servicemodel.operationcontractattribute.action.aspx