Share via


How Actions differ from Operations...

I haven't thought about the relationship between “Actions” and "Operations" for quite a while. Therefore, I thought I'd give my brain dump. I look forward to your feedback in case I have it wrong.

 

First, I thought it useful to summarize the description of a SoapAction:

 

An action (or SoapAction in Soap 1.1) is an optional parameter can be used to specify the URI that identifies the intent of the message …It is recommended that the same value be used to identify sets of message types that are logically connected in some manner, for example part of the same "service"…Use of the action parameter is OPTIONAL. SOAP Receivers MAY use it as a hint to optimize processing, but SHOULD NOT require its presence in order to operate.

 

As SoapActions are optional, you need not use the SoapAction to route the message to an operation. I found this useful blog about this issue, which describes using WCF to route the message based on the Soap Body content: https://weblogs.asp.net/cibrax/archive/2006/01/31/436973.aspx

 

What else is cool is that in WCF there is a way to trap any unmatched action using the OperationContract's Action parameter. This is really useful if you want to create your own mechanism for routing your messages, as Pablo did in the link above.

 

[ServiceContract]

public interface IMyMessageHandler

{

   [OperationContract(Action="*")]

   public void HandleAnyMessage(Message message);

}

I was trying to get a copy of what the WSDL looks like when the Action= “*”, but I kept getting the following error in the FebCTP:

The service encountered an error while generating metadata. See the trace files for more details.

 

Bill says that this might be "By Design". I'm not sure. Please attach a copy if this works for you.

 

Ali