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?
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">
<s:Header>
<a:Action s:mustUnderstand="1">http://tempuri.org/MyMethod</a:Action>
</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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With