【发布时间】:2012-03-17 19:07:15
【问题描述】:
我有一个这样定义的 WCF 服务:
[ServiceContract(Namespace = "http://AttributeServiceNameSpace", Name = "AttributeServiceName1")]
public interface IHelloIndigoService1
{
[OperationContract(Name="AttributeOperationName11", Action = "aaa2")]
String HelloIndigo11();
[OperationContract(Name = "AttributeOperationName12", Action = "aaa1")]
String HelloIndigo12();
}
我在服务调用期间捕获了 HTTP 消息,如下所示。
POST http://xxx/Service.svc/IHelloIndigoServiceAddress1HTTP/1.1
内容类型:文本/xml;字符集=utf-8
SOAPAction:“aaa2”
主机:shao-02.fareast.corp.microsoft.com
内容长度:162
期望:100-继续
连接:保持活动状态
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<AttributeOperationName11 xmlns="http://AttributeServiceNameSpace"/>
</s:Body>
</s:Envelope>
所以我们可以看到调用服务的 SOAP 消息中都存在 Action 和 Operation Name。
但我只是想知道: 为什么我们需要 Action 和 Operation Name 来识别单个服务方法?一个就够了。
【问题讨论】: