开发者

Copy the RequestMessage at IParameterInspector.BeforeCall() on WCF Service

开发者 https://www.devze.com 2023-01-09 15:24 出处:网络
I have WCF service with IParameterInspector class which suppose to store the message for each incoming message. I need to extract values from the inputs parameters.

I have WCF service with IParameterInspector class which suppose to store the message for each incoming message. I need to extract values from the inputs parameters.

In order to get the message I'm trying to access

Blockquote OperationContext.Current.RequestContext.RequestMessage Blockquote

开发者_Python百科and than call to CreateBufferedCopy() method to create a copy so I can work (read) the message and send it forward, but than I'm getting the following error:

"This message cannot support the operation because it has been read."

Any ideas? Many thanks!


IParameterInspector is fired after the message has been read by the data contract/xml serializer so the message body has been already consumed.

If you want to get the raw input message, you should be doing so in an IDispatchMessageInspector instead and make a buffered copy of the message so that you can still pass it on further down the WCF pipeline.

0

精彩评论

暂无评论...
验证码 换一张
取 消