Cache as cache can! Velocity in da house
Do you need a composite transport for WCF?

Accessing the message inside of your WCF service operations

I have been asked this question many times and thought I just put a quick note here.
If you want to access the message from a WCF service operations then you need to distinguish two cases.

Strongly-typed contracts

public string Hello(string hello)
  return hello;

Universal contracts

public void Process(Message message)

But calling ToString() on the message itself will only print <stream>…</stream> if it is a streamed message.
In these cases you may need to do something similar like the following snippet in order to print the body of the streamed message.

XmlTextWriter xtw= new XmlTextWriter(Console.Out);
xtw.Formatting = Formatting.Indented;


Feed You can follow this conversation by subscribing to the comment feed for this post.

Sasha Goldshtein

RequestContext.RequestMessage is not going to be present on one-way calls, so it's a partial solution at best. I've encountered this problem myself in the past, and ended up writing a message inspector for caching the messages:

chaussure de basket

^-^Many visitors are asking us about how this crisis will affect nonprofits.

Chaussure Jordan

Thank You for posting this. i really enjoyed reading this!!

chaussure basket

When another person pays me an sudden compliment, I normally inform them that they created my day!

Air Jordan Basket

To my mind it is a great article*.*

Inversiones en oro

I've been reading your post and I think have very good information, I would like to know the methodology you use to write your post.

Thomas Sabo Australia

I became interested in the topic and I am thinking whether I could use your texts on my paper, of course with the quotation. Please contact with me, thanks very much.

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been saved. Comments are moderated and will not appear until approved by the author. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment

Comments are moderated, and will not appear until the author has approved them.

Your Information

(Name is required. Email address will not be displayed with the comment.)