charset problem with jbossws 2.0.2 and .net clients
everlastx1 Jan 5, 2008 4:35 PMGood evening ladies and gentleman,
I am struggling sending special character like the German üö from the .net client to the jboss server.
I have the following reproducible scenario:
jboss 4.22
jbossws 2.0.2GA
.Net Client
.net is pinging the following String to jboss:
""from .NET with ü -- ö""
Jboss is receiving this string and post back an array with following to values
"from .NET with ü -- ö" the String .net sended just post it back
"Greetings from J with ü -- ö"
.net output is:
Sending: from .NET with ü -- ö
Recived from Jboss Value 1: Greetings from J with ü -- ö
Recived from Jboss Value 2: from .NET with ü -- ö
the jboss output is:
2008-01-05 21:54:36,921 DEBUG [de.Company.test.WebSevices.ServerAgentEndpointBean] from .Net recived: from .NET with ü -- ö
The interesting thing is happening when the protocol sniffer is on:
in the Sniffer: .NET is Sending
POST /SKMS_Server-SKMS_Server/ServerAgentEndpointBean HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.1433) Content-Type: text/xml; charset=utf-8 SOAPAction: "" Host: 127.0.0.1:8080 Content-Length: 359 Expect: 100-continue Connection: Keep-Alive <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <soap:Body> <test xmlns="http://WebSevices.test.company.de/"> <TestString xmlns="">from .NET with ü -- ö</TestString> </test> </soap:Body> </soap:Envelope>
in the Sniffer: Jboss Server is sending back!
HTTP/1.1 200 OK Server: Apache-Coyote/1.1 X-Powered-By: Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)/Tomcat-5.5 Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Date: Sat, 05 Jan 2008 20:54:36 GMT <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header></env:Header><env:Body> <ns2:testResponse xmlns:ns2="http://WebSevices.test.company.de/"> <return>Greetings from J with �¼ -- �¶</return><return>from .NET with �¼ -- �¶ </return></ns2:testResponse></env:Body></env:Envelope>
The .NET Client Code
test test_remote = new WebReference.test(); String tesString = "from .NET with ü -- ö"; test_remote.TestString = tesString; string[] result = new WebReference.ServerAgentEndpoint().test(test_remote); Console.WriteLine("Sending: " + tesString); Console.WriteLine("Recived from Jboss Value 1: " + result[0]); Console.WriteLine("Recived from Jboss Value 2: " + result[1]);
The Java Code is:
@WebMethod public String[] test (@WebParam(name="TestString") String str){ String[] result = new String[]{"Greetings from J with ü -- ö",str}; log.debug("from .Net recived: " + str); log.debug("This will be the result by Jboss to .Net" + result.toString()); return result; }
As I see it from the sniffer the .Net client is sendig the data right to jboss encoding the content with utf-8 and jboss is decoding it right.
When jboss is sending data to .net the data are encoded twice with utf-8
you can see it in the sniffer.
.net is sending: from .NET with ü -- ö" <<-- sniffer: encoded once with utf-8
The line "from J with �¼ -- �¶" <<-- sniffer: utf-8 over utf-8
.net did it right and encoded it to "from J with ü -- ö" <<-- decoded the string but still one utf-8 encoding is left.
so i guess something is wrong with the utf-8 encoding in jboss or jbossws?
can anybody verify my problem?
greetings
V.