WCF MessageContract Help - MessageBodyMember with hyphenated name

Posted by Hcabnettek on Stack Overflow See other posts from Stack Overflow or by Hcabnettek
Published on 2010-06-11T17:18:53Z Indexed on 2010/06/11 17:22 UTC
Read the original article Hit count: 515

Filed under:
|
|
|
|

Hi All, I need a bit of WCF help. This project uses message contracts. The transport seems to work ok. I have this code for a response type.

namespace tpoke.Contracts
{
   [MessageContract(IsWrapped = true)]
   public class AuthenticationResponseMC
   {
    [MessageBodyMember(Name = "authentication-token")]
    public Guid AuthenticationToken;
   }

}

Now when I run the operation that returns this, I try to deserialize using the XmlSerializer. The is not what I'm needing. I need it to be

<authentication-token xmlns="http://tpoke.wcf.com">e13xxxx-xxxx-xxxx-xxxxxx</authentication-token>

How can I make this work correctly? Do I need to add the namespace to MessageBodyMember? Why is the hyphen being stripped out? Any tips or advice is certainly appreciated.

Thanks,
~ck in San Diego

© Stack Overflow or respective owner

Related posts about c#

Related posts about Xml