tags:

views:

30

answers:

3

Greetings!

Here's the deal:

public static Message CreateMessage(
    MessageVersion version,
    MessageFault fault,
    string action)

action: A description of how the message should be processed.

What do you guys put in there? "Handle with care!!!" or "FRAGILE"? Does it make any difference in the end?

Thanks

A: 

I asked a question about the SOAPAction recently: - I think that the SOAPAction header is used in routing messages within a WSDL operation, but I've not managed to find anything which explicitly states that the @soapAction attrib has to be unique within the containing operation (which would seem to be a prerequisite for a sane WSDL routing component....)

Robin
+1  A: 

The "Action" is one of the strings in the message header.

For example, this call

        var m = Message.CreateMessage(MessageVersion.Default, "http://tempuri.org/MyMethod");

Produces this message

<s:Envelope
xmlns:a="http://www.w3.org/2005/08/addressing"
xmlns:s="http://www.w3.org/2003/05/soap-envelope"&gt;
<s:Header>
     <a:Action s:mustUnderstand="1">http://tempuri.org/MyMethod&lt;/a:Action&gt;
 </s:Header>   <s:Body />
 </s:Envelope>

Each message has an "action" header, and each WCF operation has an "action" attribute. The WCF system will compare these values when determining which operation to dispatch each message to.

Normally, you aren't manually generating messages so you don't have to worry about this - it's all handled as expected by default values.

When you define the Service Contract you can explicitly associate an action string with an operation:

[ServiceContract]
interface MyService
{
   [OperationContract(Action="http://tempuri.org/MyMethod")]
   void ThisIsntReallyCalledMyMethod(string parameter1);
}
Andrew Shepherd