-
1. Re: Encoding of response
jim.ma May 21, 2012 5:05 AM (in response to nickarls)Hi Nicklas, what is the payload printed by logginInInterceptor ? If it is "??????", it could be the client side issue and it doesn't encode the "åäöÅÄÖ" correctly. I had a quick try in CXF , send this request with ISO-8859-1 encoded and cxf can handle the response correctly.
-
2. Re: Encoding of response
nickarls May 21, 2012 5:55 AM (in response to jim.ma)12:50:59,837 INFO [org.apache.cxf.interceptor.LoggingInInterceptor] (http--0.0.0.0-80-5) Inbound Message ---------------------------- ID: 4 Address: http://fikarlsnic01/OSTi/WebMarelaReportWebService Encoding: ISO-8859-1 Http-Method: POST Content-Type: text/xml Headers: {Accept=[text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2], cache-control=[no-cache], connection=[Close], Content-Length=[554], content-type=[text/xml], host=[fikarlsnic01], pragma=[no-cache], SOAPAction=[], user-agent=[Java/1.7.0]} Payload: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body> <m:haeKulutusraportti xmlns:m="http://report.webmarela.osti.affecto.fi/"> <arg0>V2</arg0> <arg1>WebMarela</arg1> <arg2>0018</arg2> <arg3>012011</arg3> <arg4>012012</arg4> <arg5>cafebabe1</arg5> </m:haeKulutusraportti> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
12:50:59,500 INFO [org.apache.cxf.interceptor.LoggingOutInterceptor] (http--0.0.0.0-80-5) Outbound Message --------------------------- ID: 3 Encoding: ISO-8859-1 Content-Type: text/xml Headers: {} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:haeKulutusraporttiResponse xmlns:ns2="http://report.webmarela.osti.affecto.fi/"><return><otsikko><arvo10>0.0</arvo10><arvo11>0.0</arvo11><arvo12>0.0</arvo12><arvo13>0.0</arvo13><arvo14>0.0</arvo14><arvo15>0.0</arvo15><arvo2>Ajalta :01.11.0120 - 31.12.0120</arvo2><arvo3>.</arvo3><arvo4>.</arvo4><arvo5>.</arvo5><arvo6>0.0</arvo6><arvo7>0.0</arvo7><arvo8>0.0</arvo8><arvo9>0.0</arvo9><id><arvo1>??????</arvo1><naytto>MYY917</naytto><numero>1428</numero><tunnus>0000000000</tunnus></id><raportti>.</raportti></otsikko></return></ns2:haeKulutusraporttiResponse></soap:Body></soap:Envelope> --------------------------------------
The question marks come in the <arvo1> where the åäöÅÄÖ was sent
-
3. Re: Encoding of response
nickarls May 22, 2012 2:50 AM (in response to nickarls)Some further testing:
case 1, soapUI, åäö OK
request
ID: 1 Address: http://fikarlsnic01/OSTi/WebMarelaReportWebService Encoding: UTF-8 Http-Method: POST Content-Type: text/xml;charset=UTF-8 Headers: {accept-encoding=[gzip,deflate], Content-Length=[444], content-type=[text/xml;charset=UTF-8], host=[fikarlsnic01], SOAPAction=[""], user-agent=[Jakarta Commons-HttpClient/3.1]} Payload: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://report.webmarela.osti.affecto.fi/"> ...
response
ID: 1 Encoding: UTF-8 Content-Type: text/xml Headers: {} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ...
case 2, httpClient (saved request from soapUI), åäö become "???"
request
ID: 2 Address: http://fikarlsnic01/OSTi/WebMarelaReportWebService Encoding: ISO-8859-1 Http-Method: POST Content-Type: text/xml; charset=ISO-8859-1 Headers: {connection=[Keep-Alive], Content-Length=[443], content-type=[text/xml; charset=ISO-8859-1], host=[fikarlsnic01:80], user-agent=[Apache-HttpClient/4.1.3 (java 1.5)]} Payload: soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:rep="http://report.webmarela.osti.affecto.fi/"> ...
response
ID: 2 Encoding: ISO-8859-1 Content-Type: text/xml Headers: {} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ...
case 3, BIRT report viewer call, åäö become "???"
request
ID: 3 Address: http://fikarlsnic01/OSTi/WebMarelaReportWebService Encoding: ISO-8859-1 Http-Method: POST Content-Type: text/xml Headers: {Accept=[text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2], cache-control=[no-cache], connection=[Close], Content-Length=[554], content-type=[text/xml], host=[fikarlsnic01], pragma=[no-cache], SOAPAction=[], user-agent=[Java/1.7.0]} Payload: <?xml version="1.0"?> <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> ...
response
ID: 6 Encoding: ISO-8859-1 Content-Type: text/xml Headers: {} Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> ...
So in my environment UTF-encoded request/reponse works fine but ISO-8859-1 fails for both httpClient and the BIRT viewer.
-
4. Re: Encoding of response
nickarls May 22, 2012 2:52 AM (in response to nickarls)A strange thing is also that httpClient doesn't work for UTF-8 encoding. But SoapUI works even if it apparently uses httpClient internally. Sigh.
-
5. Re: Encoding of response
jim.ma May 22, 2012 7:37 AM (in response to nickarls)Is there any special operation in the
ReportWebService
to generate '"åäöÅÄÖ" ? CXF sets the response with same encoding style as request. I think add an intercetor after org.apache.cxf.interceptor.StaxInInterceptor could change the response encoding to what you want:public class ChangeEncodingInterceptor extends AbstractPhaseInterceptor<Message> {
....
public void handleMessage(Message message) {
message.put(Message.ENCODING, "UTF-8");
}
}