Hi!
I have a WCF client that wants to consume a JBossWS (Native) Service with MTOM, but when I run the client the following error occurs:
Root MIME part must contain non-zero length value for 'charset' parameter in Content-Type header.
According to [1] this error occurs because the WCF client is expecting to receive the charset in the root MIME Content-Type header. The response message is this:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@ws.jboss.org>";start-info="text/xml";boundary="----=_Part_3_27962205.1283538375093"
Date: Fri, 03 Sep 2010 18:26:15 GMT
Content-Length: 3982344
-
=_Part_3_27962205.1283538375093
Content-Type: application/xop+xml; type="text/xml"
Content-Transfer-Encoding: 8bit
Content-ID:
-
=_Part_3_27962205.1283538375093
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
Content-Id: <content-dcab441-3b16-4348-863f-31585ce7bda0@ws.jboss.org>
Binary content
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
Content-Type: multipart/related; type="application/xop+xml"; start="<rootpart@ws.jboss.org>"; start-info="text/xml"; boundary="----=_Part_3_27962205.1283538375093" Date: Fri, 03 Sep 2010 18:26:15 GMT
Content-Length: 3982344
------=_Part_3_27962205.1283538375093
Content-Type: application/xop+xml; type="text/xml"
Content-Transfer-Encoding: 8bit
------=_Part_3_27962205.1283538375093
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
If you look carefully, the MIME Root doesn't have the charset in the Content-Type header.
Looking at [2], .NET says "While XOP defines the charset parameter for application/xop+xml to be optional, it is needed for interoperability similar to the BP 1.1 requirement on the charset parameter for the text/xml media type."
The BP 1.2 has a recommendation related to this:
R1018 A SIMPLE_SOAP_MESSAGE MUST indicate the correct character encoding, using the "charset" parameter.
The following message works correctly and has the charset defined in the Content-Type header:
HTTP/1.1 200 OK
Content-Length: 3407478
Content-Type: multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:774aed72-9fbd-43ba-a09a-24a5a025899e+id=2";start-info="text/xml"
Server: Microsoft-HTTPAPI/1.0
MIME-Version: 1.0
Date: Fri, 03 Sep 2010 18:33:41 GMT
--uuid:774aed72-9fbd-43ba-a09a-24a5a025899e+id=2
Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><GetDataResponse xmlns="http://tempuri.org/"><GetDataResult><xop:Include href="cid:http%3A%2F%2Ftempuri.org%2F1%2F634191248212968750" xmlns:xop="http://www.w3.org/2004/08/xop/include"/></GetDataResult></GetDataResponse></s:Body></s:Envelope>
--uuid:774aed72-9fbd-43ba-a09a-24a5a025899e+id=2
Content-ID: <http://tempuri.org/1/634191248212968750>
Content-Transfer-Encoding: binary
Content-Type: application/octet-stream
is there a way to set the charset on the jboss response?
Thanks in advance!
Regards
Guzmán
[1] http://blogs.msdn.com/b/distributedservices/archive/2010/01/06/manipulate-a-wcf-request-response-using-a-custom-encoder.aspx
[2] http://msdn.microsoft.com/en-us/library/aa738574.aspx