I am having an issue similar to this question:
Problem with WCF and Multiple Namespaces
The major difference I am having is that I don’t control both ends of the wire. My setup is similar to this:
My.Objects
My.LoginService
My.Service1
My.Service2
The first thing you do is login via the login service and receive a security ticket. The ticket object is located in the My.Objects namespace. For each subsequent call in My.Service1 and My.Service2 you have to pass in the security ticket to authenticate the call. The issue I am having is that instead of the client (a .net one for now but Java and others in the future) seeing one My.Objects.Ticket the references are resolving as My.LoginService.Ticket, My.Service1.Ticket, and My.Service2.Ticket. When the client tries to pass the object retrieved during login to any other function it is receiving an object mismatch error.
How can I make each service resolve objects to the My.Objects namespace?
Have a look at the NetDataContractSerializer, might be what you’re looking for. It’s different from the DataContractSerializer in that it includes the CLR type information in the serialized XML which allows you to share your type but forces both ends of the wire to use the same type.
Have a look at a blog post I put together and an attribute (from another blog I stumbled across) to inject it on operations that needs to use it:
http://theburningmonk.com/2010/08/wcf-using-the-netdatacontractserializer-to-share-your-type/