Get operation name in Message Inspector?

Im using IClientMessageInspectormessage input / output, but the problem is that I cannot find how to get the operation name from AfterReceivedReplyand BeforeSendRequest.

I tested the following:

if ((action = reply.Headers.Action.Split('/').LastOrDefault()) != null)
{
   callInformation.Action = action;
   callInformation.Address = reply.Headers.Action.Replace(action, "");
}

This works fine in BeforeSendRequest, but AfterReveivedReplydoes it return something else, often with an “Answer” at the end?

How to get only the name of the operation in these methods?

Let's say that my operation is called MyOperation, and the attribute OperationContractindicates action = "MyOpeation"(misspelling). This result is what MyOpeationwill be extracted in BeforeSendRequestand AfterReceiveReplywill return MyOperationResponse.

So, it BeforeSendRequestwill retrieve the specified action in the attribute, and it AfterReceiveReplywill retrieve the real name of the operation, but with the addition of the “Answer” at the end?

/ , , , , ?

OperationContext.Current.IncomingMessageHeaders.Action, OperationContect.Current null .

+5

All Articles