Custom message headers in WCF on Mono

Posted by TheNextman on Stack Overflow See other posts from Stack Overflow or by TheNextman
Published on 2010-04-19T20:57:12Z Indexed on 2010/05/05 15:38 UTC
Read the original article Hit count: 637

Filed under:
|
|
|

I'm making WCF calls from a Mono client running on Ubuntu (Mono 2.6).

I can't seem to add a custom header to my messages. I have tried two different ways:

  • Using a [MessageContract] and [MessageHeader] attributes on a custom class
  • Adding the header to the outgoing messages programmatically, e.g.

    MessageHeader mhg = new MessageHeader("test");
    MessageHeader untyped = mhg.GetUntypedHeader("token", "ns");
    OperationContext.Current.OutgoingMessageHeaders.Add(untyped);

The header is not there when the call reaches the server! It's always null.

Note that both methods work fine running on .NET in Windows. Also note that the message body gets through just fine on Mono.

I see some references online that suggest this should work:

http://forums.monotouch.net/yaf_postsm1692.aspx
https://bugzilla.novell.com/show_bug.cgi?id=551745

Also - the Mono status page shows that all the MessageHeader stuff is fully implemented...

Anyone had luck with this?

Thanks in advance, Richard

© Stack Overflow or respective owner

Related posts about mono

Related posts about wcf