Reputation: 64391
I have a WCF service defined like this:
[ServiceContract(Namespace = "http://AttributeServiceNameSpace", Name = "AttributeServiceName1")]
public interface IHelloIndigoService1
{
[OperationContract(Name="AttributeOperationName11", Action = "aaa2")]
String HelloIndigo11();
[OperationContract(Name = "AttributeOperationName12", Action = "aaa1")]
String HelloIndigo12();
}
And I captured the HTTP message during the service invocation, as below.
POST http://xxx/Service.svc/IHelloIndigoServiceAddress1 HTTP/1.1
Content-Type: text/xml; charset=utf-8
SOAPAction: "aaa2"
Host: shao-02.fareast.corp.microsoft.com
Content-Length: 162
Expect: 100-continue
Connection: Keep-Alive
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<AttributeOperationName11 xmlns="http://AttributeServiceNameSpace"/>
</s:Body>
</s:Envelope>
So we can see the Action and Operation Name both exist in the SOAP message to invoke the service.
But I just wonder: Why do we need the Action and the Operation Name to identify a single service method? Only one should be enough.
Upvotes: 4
Views: 1828
Reputation: 364389
You don't need Action
and OperationName
to identify service operation. Operation name defines structure (wrapper element name) of the SOAP message but it is not used for operation identification. The action is used for operation identification.
There are some non standard SOAP parsers using operation name (root body element) for operation identification but those parsers don't use SOAP action.
Edit: I had a discussion with my colleague today and it looks like my previous answer isn't correct. The real unique identification of the message in SOAP protocol is SOAP Action + Root element. So in this case the Action
defines SOAP Action and OperationName
defines wrapper element's name (used as root message element).
Upvotes: 2