.NET-to-Java interop issue when using SOAP/TCP
We have discovered the following issue while doing .NET-to-Java communications using SOAP/TCP as the transport. The Noemax SOAP/TCP implementation included in WCF-Xtensions was used on the .NET CF side.
This is what happens:
- While negotiating the session, the .NET CF client sends to GlassFish an initSession request message encoded as text XML over SOAP/TCP.
- The Java server replies with an initSessionResponse message which is also encoded as text XML. However, the TextMessageEncoder component of .NET refuses to accept this message and throws the following System.ServiceModel.CommunicationException: "An XML declaration with an encoding is required for all non-UTF8 documents."
The declaration at the beginning of the response message sent by the Java side is <?xml version="1.0" ?>. It seems that the text message encoding implementation of .NET CF requires an explicit declaration of the charset encoding. Simply changing this string to <?xml version="1.0" encoding="utf-8" ?> fixes the issue.
IMO this is a general interoperability problem between Java and .NET CF.
Please note that there is no such problem when SOAP/TCP is used as the transport between desktop .NET (i.e. non-compact framework) and Java, this problem only arises with the text message encoding implementation of .NET CF 3.5.