You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Andreas Veithen <an...@gmail.com> on 2009/08/14 12:20:18 UTC
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Which version of Axis2 do you use?
Andreas
On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com> wrote:
> Hello,
> I'm seeking some advice/help with a character encoding problem with an axis2
> service (i.e. server side).
>
> When my service receives a (WS/SOAP) request with:
> Content-Type: text/xml; charset=UTF-8
> in the HTTP header, everything works fine, any unusual charcters in the
> response are correctly encoded in UTF-8.
>
> But when the service receives a request with:
> Content-Type: text/xml; charset=ISO-8859-1
> the response is inconsistent. The response is labelled as ISO-8859-1:
> Content-Type: text/xml; charset=ISO-8859-1
> <?xml version="1.0" encoding="ISO-8859-1"?>
> but in fact the message body is still encoded in UTF-8.
>
> Should the axis2 engine automatically select and use ISO-8859-1 encoding for
> the response? Or is it something I need to configure? Or is it always UTF-8?
>
> I understood from a previous thread ("How to change Axis2 response character
> encoding") that axis2 selects a a message builder based on the Content-Type
> header. My axis2.xml config does not contain anything specifically for
> "text/xml" :
>
> <messageBuilders>
> <messageBuilder contentType="application/xml"
>
> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> <messageBuilder contentType="application/xml"
>
> class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> <messageBuilder contentType="application/x-www-form-urlencoded"
>
> class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
> <messageBuilder contentType="multipart/form-data"
>
> class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
> </messageBuilders>
>
> Is this where I need to intervene to control the response encoding?
>
> Thanks in advance for any help you can provide.
>
> Michael Fryars
>
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Posted by Michael Fryars <fr...@gmail.com>.
Thanks for your help, Andreas. JIRA issue created: AXIS2-4468
Michael
On Tue, Aug 18, 2009 at 10:17 PM, Andreas Veithen <andreas.veithen@gmail.com
> wrote:
> Michael,
>
> The following log message is interesting:
>
> org.apache.axiom.om.impl.MTOMXMLStreamWriter - Returning access to
> the original output stream: java.io.BufferedOutputStream@14181418
>
> It means that the xmlbeans databinding bypasses the normal StAX
> XMLStreamWriter and writes part of the output directly to the
> underlying byte stream. It is probably at that moment that things go
> wrong. Can you please open a JIRA [1] and attach a sample AAR (or WAR)
> that allows us to reproduce this problem?
>
> Andreas
>
> [1] https://issues.apache.org/jira/
>
> On Tue, Aug 18, 2009 at 12:41, Michael Fryars<fr...@gmail.com> wrote:
> > Andreas, here's the result of my test with Tomcat/Axis2-1.5, using a
> simple
> > echo service, databinding is xmlbeans, the WS client is SOAPUI 3.0.
> >
> > There are two requests to the same service. The request parameters don't
> > change, but the encoding is UTF-8 for the first request, then ISO-8859-1
> for
> > the second.
> >
> > Here is what SOAPUI displayed for these requests: 4 views per request:
> > _01 main request view
> > _02 raw request view
> > _03 raw response view
> > _04 main response view
> >
> > ## exp01 SOAPUI request in UTF-8
> > ## 01_01
> > <?xml version='1.0' encoding='UTF-8'?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <soapenv:Header/>
> > <soapenv:Body>
> > <urn:echoParameter>
> > <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> > </urn:echoParameter>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 01_02
> > POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
> > Accept-Encoding: gzip,deflate
> > Content-Type: text/xml;charset=UTF-8
> > SOAPAction: "echo"
> > User-Agent: Jakarta Commons-HttpClient/3.1
> > Host: localhost:8080
> > Content-Length: 367
> >
> > <?xml version='1.0' encoding='UTF-8'?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <soapenv:Header/>
> > <soapenv:Body>
> > <urn:echoParameter>
> > <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> > </urn:echoParameter>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 01_03
> > HTTP/1.1 200 OK
> > Server: Apache-Coyote/1.1
> > Content-Type: text/xml;charset=UTF-8
> > Transfer-Encoding: chunked
> > Date: Tue, 18 Aug 2009 09:15:18 GMT
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <urn:serverMsg>là ça veut dire : déjà été à la
> > plage</urn:serverMsg>
> > </urn:echoResult>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 01_04
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <urn:serverMsg>là ça veut dire : déjà été à la
> > plage</urn:serverMsg>
> > </urn:echoResult>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> >
> > ## exp01 SOAPUI request in ISO-8859-1
> > ## 02_01
> > <?xml version='1.0' encoding='ISO-8859-1'?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <soapenv:Header/>
> > <soapenv:Body>
> > <urn:echoParameter>
> > <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> > </urn:echoParameter>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 02_02
> > POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
> > Accept-Encoding: gzip,deflate
> > Content-Type: text/xml;charset=iso-8859-1
> > SOAPAction: "echo"
> > User-Agent: Jakarta Commons-HttpClient/3.1
> > Host: localhost:8080
> > Content-Length: 367
> >
> > <?xml version='1.0' encoding='ISO-8859-1'?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <soapenv:Header/>
> > <soapenv:Body>
> > <urn:echoParameter>
> > <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> > </urn:echoParameter>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 02_03
> > HTTP/1.1 200 OK
> > Server: Apache-Coyote/1.1
> > Content-Type: text/xml;charset=iso-8859-1
> > Transfer-Encoding: chunked
> > Date: Tue, 18 Aug 2009 09:20:07 GMT
> >
> > <?xml version="1.0" encoding="iso-8859-1"?>
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <urn:serverMsg>là ça veut dire : déjà été à la
> > plage</urn:serverMsg>
> > </urn:echoResult>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> > ## 02_04
> > <soapenv:Envelope xmlns:soapenv="
> http://schemas.xmlsoap.org/soap/envelope/">
> > <soapenv:Body>
> > <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> > <urn:serverMsg>là ça veut dire : déjà été à la
> > plage</urn:serverMsg>
> > </urn:echoResult>
> > </soapenv:Body>
> > </soapenv:Envelope>
> >
> >
> > I confirmed that my server-side handler receives a correctly decoded
> > parameter string from Axis2 (i.e. UTF-8 => unicode, ISO-8859-1 =>
> unicode).
> > But you can see that the response in the ISO-8859-1 case is not correctly
> > encoded: the special characters are still in UTF-8.
> >
> > Debug trace files for the two request/response trials are attached to
> this
> > message.
> >
> > Best regards,
> >
> > Michael
> >
> >
> > On Fri, Aug 14, 2009 at 7:11 PM, Andreas Veithen <
> andreas.veithen@gmail.com>
> > wrote:
> >>
> >> Michael,
> >>
> >> Can you test this with 1.5 and if the problem persists, create a
> >> minimal AAR that reproduces the problem (so that we can debug it)?
> >>
> >> Andreas
> >>
> >> On Fri, Aug 14, 2009 at 12:27, Michael Fryars<fr...@gmail.com>
> wrote:
> >> > Axis2 v1.4.1, running in a WAR in a tomcat 6 container.
> >> >
> >> > On Fri, Aug 14, 2009 at 12:20 PM, Andreas Veithen
> >> > <an...@gmail.com> wrote:
> >> >>
> >> >> Which version of Axis2 do you use?
> >> >>
> >> >> Andreas
> >> >>
> >> >> On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com>
> >> >> wrote:
> >> >> > Hello,
> >> >> > I'm seeking some advice/help with a character encoding problem with
> >> >> > an
> >> >> > axis2
> >> >> > service (i.e. server side).
> >> >> >
> >> >> > When my service receives a (WS/SOAP) request with:
> >> >> > Content-Type: text/xml; charset=UTF-8
> >> >> > in the HTTP header, everything works fine, any unusual charcters in
> >> >> > the
> >> >> > response are correctly encoded in UTF-8.
> >> >> >
> >> >> > But when the service receives a request with:
> >> >> > Content-Type: text/xml; charset=ISO-8859-1
> >> >> > the response is inconsistent. The response is labelled as
> ISO-8859-1:
> >> >> > Content-Type: text/xml; charset=ISO-8859-1
> >> >> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >> >> > but in fact the message body is still encoded in UTF-8.
> >> >> >
> >> >> > Should the axis2 engine automatically select and use ISO-8859-1
> >> >> > encoding
> >> >> > for
> >> >> > the response? Or is it something I need to configure? Or is it
> always
> >> >> > UTF-8?
> >> >> >
> >> >> > I understood from a previous thread ("How to change Axis2 response
> >> >> > character
> >> >> > encoding") that axis2 selects a a message builder based on the
> >> >> > Content-Type
> >> >> > header. My axis2.xml config does not contain anything specifically
> >> >> > for
> >> >> > "text/xml" :
> >> >> >
> >> >> > <messageBuilders>
> >> >> > <messageBuilder contentType="application/xml"
> >> >> >
> >> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >> >> > <messageBuilder contentType="application/xml"
> >> >> >
> >> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >> >> > <messageBuilder
> >> >> > contentType="application/x-www-form-urlencoded"
> >> >> >
> >> >> > class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
> >> >> > <messageBuilder contentType="multipart/form-data"
> >> >> >
> >> >> > class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
> >> >> > </messageBuilders>
> >> >> >
> >> >> > Is this where I need to intervene to control the response encoding?
> >> >> >
> >> >> > Thanks in advance for any help you can provide.
> >> >> >
> >> >> > Michael Fryars
> >> >> >
> >> >
> >> >
> >
> >
>
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Posted by Andreas Veithen <an...@gmail.com>.
Michael,
The following log message is interesting:
org.apache.axiom.om.impl.MTOMXMLStreamWriter - Returning access to
the original output stream: java.io.BufferedOutputStream@14181418
It means that the xmlbeans databinding bypasses the normal StAX
XMLStreamWriter and writes part of the output directly to the
underlying byte stream. It is probably at that moment that things go
wrong. Can you please open a JIRA [1] and attach a sample AAR (or WAR)
that allows us to reproduce this problem?
Andreas
[1] https://issues.apache.org/jira/
On Tue, Aug 18, 2009 at 12:41, Michael Fryars<fr...@gmail.com> wrote:
> Andreas, here's the result of my test with Tomcat/Axis2-1.5, using a simple
> echo service, databinding is xmlbeans, the WS client is SOAPUI 3.0.
>
> There are two requests to the same service. The request parameters don't
> change, but the encoding is UTF-8 for the first request, then ISO-8859-1 for
> the second.
>
> Here is what SOAPUI displayed for these requests: 4 views per request:
> _01 main request view
> _02 raw request view
> _03 raw response view
> _04 main response view
>
> ## exp01 SOAPUI request in UTF-8
> ## 01_01
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <soapenv:Header/>
> <soapenv:Body>
> <urn:echoParameter>
> <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> </urn:echoParameter>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 01_02
> POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
> Accept-Encoding: gzip,deflate
> Content-Type: text/xml;charset=UTF-8
> SOAPAction: "echo"
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: localhost:8080
> Content-Length: 367
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <soapenv:Header/>
> <soapenv:Body>
> <urn:echoParameter>
> <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> </urn:echoParameter>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 01_03
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Content-Type: text/xml;charset=UTF-8
> Transfer-Encoding: chunked
> Date: Tue, 18 Aug 2009 09:15:18 GMT
>
> <?xml version="1.0" encoding="UTF-8"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <urn:serverMsg>là ça veut dire : déjà été à la
> plage</urn:serverMsg>
> </urn:echoResult>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 01_04
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <urn:serverMsg>là ça veut dire : déjà été à la
> plage</urn:serverMsg>
> </urn:echoResult>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> ## exp01 SOAPUI request in ISO-8859-1
> ## 02_01
> <?xml version='1.0' encoding='ISO-8859-1'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <soapenv:Header/>
> <soapenv:Body>
> <urn:echoParameter>
> <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> </urn:echoParameter>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 02_02
> POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
> Accept-Encoding: gzip,deflate
> Content-Type: text/xml;charset=iso-8859-1
> SOAPAction: "echo"
> User-Agent: Jakarta Commons-HttpClient/3.1
> Host: localhost:8080
> Content-Length: 367
>
> <?xml version='1.0' encoding='ISO-8859-1'?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
> xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <soapenv:Header/>
> <soapenv:Body>
> <urn:echoParameter>
> <urn:clientMsg>déjà été à la plage</urn:clientMsg>
> </urn:echoParameter>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 02_03
> HTTP/1.1 200 OK
> Server: Apache-Coyote/1.1
> Content-Type: text/xml;charset=iso-8859-1
> Transfer-Encoding: chunked
> Date: Tue, 18 Aug 2009 09:20:07 GMT
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <urn:serverMsg>là ça veut dire : déjà été à la
> plage</urn:serverMsg>
> </urn:echoResult>
> </soapenv:Body>
> </soapenv:Envelope>
>
> ## 02_04
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Body>
> <urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
> <urn:serverMsg>là ça veut dire : déjà été à la
> plage</urn:serverMsg>
> </urn:echoResult>
> </soapenv:Body>
> </soapenv:Envelope>
>
>
> I confirmed that my server-side handler receives a correctly decoded
> parameter string from Axis2 (i.e. UTF-8 => unicode, ISO-8859-1 => unicode).
> But you can see that the response in the ISO-8859-1 case is not correctly
> encoded: the special characters are still in UTF-8.
>
> Debug trace files for the two request/response trials are attached to this
> message.
>
> Best regards,
>
> Michael
>
>
> On Fri, Aug 14, 2009 at 7:11 PM, Andreas Veithen <an...@gmail.com>
> wrote:
>>
>> Michael,
>>
>> Can you test this with 1.5 and if the problem persists, create a
>> minimal AAR that reproduces the problem (so that we can debug it)?
>>
>> Andreas
>>
>> On Fri, Aug 14, 2009 at 12:27, Michael Fryars<fr...@gmail.com> wrote:
>> > Axis2 v1.4.1, running in a WAR in a tomcat 6 container.
>> >
>> > On Fri, Aug 14, 2009 at 12:20 PM, Andreas Veithen
>> > <an...@gmail.com> wrote:
>> >>
>> >> Which version of Axis2 do you use?
>> >>
>> >> Andreas
>> >>
>> >> On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com>
>> >> wrote:
>> >> > Hello,
>> >> > I'm seeking some advice/help with a character encoding problem with
>> >> > an
>> >> > axis2
>> >> > service (i.e. server side).
>> >> >
>> >> > When my service receives a (WS/SOAP) request with:
>> >> > Content-Type: text/xml; charset=UTF-8
>> >> > in the HTTP header, everything works fine, any unusual charcters in
>> >> > the
>> >> > response are correctly encoded in UTF-8.
>> >> >
>> >> > But when the service receives a request with:
>> >> > Content-Type: text/xml; charset=ISO-8859-1
>> >> > the response is inconsistent. The response is labelled as ISO-8859-1:
>> >> > Content-Type: text/xml; charset=ISO-8859-1
>> >> > <?xml version="1.0" encoding="ISO-8859-1"?>
>> >> > but in fact the message body is still encoded in UTF-8.
>> >> >
>> >> > Should the axis2 engine automatically select and use ISO-8859-1
>> >> > encoding
>> >> > for
>> >> > the response? Or is it something I need to configure? Or is it always
>> >> > UTF-8?
>> >> >
>> >> > I understood from a previous thread ("How to change Axis2 response
>> >> > character
>> >> > encoding") that axis2 selects a a message builder based on the
>> >> > Content-Type
>> >> > header. My axis2.xml config does not contain anything specifically
>> >> > for
>> >> > "text/xml" :
>> >> >
>> >> > <messageBuilders>
>> >> > <messageBuilder contentType="application/xml"
>> >> >
>> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>> >> > <messageBuilder contentType="application/xml"
>> >> >
>> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>> >> > <messageBuilder
>> >> > contentType="application/x-www-form-urlencoded"
>> >> >
>> >> > class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
>> >> > <messageBuilder contentType="multipart/form-data"
>> >> >
>> >> > class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
>> >> > </messageBuilders>
>> >> >
>> >> > Is this where I need to intervene to control the response encoding?
>> >> >
>> >> > Thanks in advance for any help you can provide.
>> >> >
>> >> > Michael Fryars
>> >> >
>> >
>> >
>
>
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Posted by Michael Fryars <fr...@gmail.com>.
Andreas, here's the result of my test with Tomcat/Axis2-1.5, using a simple
echo service, databinding is xmlbeans, the WS client is SOAPUI 3.0.
There are two requests to the same service. The request parameters don't
change, but the encoding is UTF-8 for the first request, then ISO-8859-1 for
the second.
Here is what SOAPUI displayed for these requests: 4 views per request:
_01 main request view
_02 raw request view
_03 raw response view
_04 main response view
## exp01 SOAPUI request in UTF-8
## 01_01
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<soapenv:Header/>
<soapenv:Body>
<urn:echoParameter>
<urn:clientMsg>déjà été à la plage</urn:clientMsg>
</urn:echoParameter>
</soapenv:Body>
</soapenv:Envelope>
## 01_02
POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=UTF-8
SOAPAction: "echo"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8080
Content-Length: 367
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<soapenv:Header/>
<soapenv:Body>
<urn:echoParameter>
<urn:clientMsg>déjà été à la plage</urn:clientMsg>
</urn:echoParameter>
</soapenv:Body>
</soapenv:Envelope>
## 01_03
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 18 Aug 2009 09:15:18 GMT
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<urn:serverMsg>là ça veut dire : déjà été à la
plage</urn:serverMsg>
</urn:echoResult>
</soapenv:Body>
</soapenv:Envelope>
## 01_04
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<urn:serverMsg>là ça veut dire : déjà été à la
plage</urn:serverMsg>
</urn:echoResult>
</soapenv:Body>
</soapenv:Envelope>
## exp01 SOAPUI request in ISO-8859-1
## 02_01
<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<soapenv:Header/>
<soapenv:Body>
<urn:echoParameter>
<urn:clientMsg>déjà été à la plage</urn:clientMsg>
</urn:echoParameter>
</soapenv:Body>
</soapenv:Envelope>
## 02_02
POST http://localhost:8080/MfrTestWar/services/EchoService_1 HTTP/1.1
Accept-Encoding: gzip,deflate
Content-Type: text/xml;charset=iso-8859-1
SOAPAction: "echo"
User-Agent: Jakarta Commons-HttpClient/3.1
Host: localhost:8080
Content-Length: 367
<?xml version='1.0' encoding='ISO-8859-1'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<soapenv:Header/>
<soapenv:Body>
<urn:echoParameter>
<urn:clientMsg>déjà été à la plage</urn:clientMsg>
</urn:echoParameter>
</soapenv:Body>
</soapenv:Envelope>
## 02_03
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=iso-8859-1
Transfer-Encoding: chunked
Date: Tue, 18 Aug 2009 09:20:07 GMT
<?xml version="1.0" encoding="iso-8859-1"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<urn:serverMsg>là ça veut dire : déjà été à la
plage</urn:serverMsg>
</urn:echoResult>
</soapenv:Body>
</soapenv:Envelope>
## 02_04
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<urn:echoResult xmlns:urn="urn:transport:mfrtest:1:api:axistest">
<urn:serverMsg>là ça veut dire : déjà été à la
plage</urn:serverMsg>
</urn:echoResult>
</soapenv:Body>
</soapenv:Envelope>
I confirmed that my server-side handler receives a correctly decoded
parameter string from Axis2 (i.e. UTF-8 => unicode, ISO-8859-1 => unicode).
But you can see that the response in the ISO-8859-1 case is not correctly
encoded: the special characters are still in UTF-8.
Debug trace files for the two request/response trials are attached to this
message.
Best regards,
Michael
On Fri, Aug 14, 2009 at 7:11 PM, Andreas Veithen
<an...@gmail.com>wrote:
> Michael,
>
> Can you test this with 1.5 and if the problem persists, create a
> minimal AAR that reproduces the problem (so that we can debug it)?
>
> Andreas
>
> On Fri, Aug 14, 2009 at 12:27, Michael Fryars<fr...@gmail.com> wrote:
> > Axis2 v1.4.1, running in a WAR in a tomcat 6 container.
> >
> > On Fri, Aug 14, 2009 at 12:20 PM, Andreas Veithen
> > <an...@gmail.com> wrote:
> >>
> >> Which version of Axis2 do you use?
> >>
> >> Andreas
> >>
> >> On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com>
> wrote:
> >> > Hello,
> >> > I'm seeking some advice/help with a character encoding problem with an
> >> > axis2
> >> > service (i.e. server side).
> >> >
> >> > When my service receives a (WS/SOAP) request with:
> >> > Content-Type: text/xml; charset=UTF-8
> >> > in the HTTP header, everything works fine, any unusual charcters in
> the
> >> > response are correctly encoded in UTF-8.
> >> >
> >> > But when the service receives a request with:
> >> > Content-Type: text/xml; charset=ISO-8859-1
> >> > the response is inconsistent. The response is labelled as ISO-8859-1:
> >> > Content-Type: text/xml; charset=ISO-8859-1
> >> > <?xml version="1.0" encoding="ISO-8859-1"?>
> >> > but in fact the message body is still encoded in UTF-8.
> >> >
> >> > Should the axis2 engine automatically select and use ISO-8859-1
> encoding
> >> > for
> >> > the response? Or is it something I need to configure? Or is it always
> >> > UTF-8?
> >> >
> >> > I understood from a previous thread ("How to change Axis2 response
> >> > character
> >> > encoding") that axis2 selects a a message builder based on the
> >> > Content-Type
> >> > header. My axis2.xml config does not contain anything specifically for
> >> > "text/xml" :
> >> >
> >> > <messageBuilders>
> >> > <messageBuilder contentType="application/xml"
> >> >
> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >> > <messageBuilder contentType="application/xml"
> >> >
> >> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> >> > <messageBuilder
> contentType="application/x-www-form-urlencoded"
> >> >
> >> > class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
> >> > <messageBuilder contentType="multipart/form-data"
> >> >
> >> > class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
> >> > </messageBuilders>
> >> >
> >> > Is this where I need to intervene to control the response encoding?
> >> >
> >> > Thanks in advance for any help you can provide.
> >> >
> >> > Michael Fryars
> >> >
> >
> >
>
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Posted by Andreas Veithen <an...@gmail.com>.
Michael,
Can you test this with 1.5 and if the problem persists, create a
minimal AAR that reproduces the problem (so that we can debug it)?
Andreas
On Fri, Aug 14, 2009 at 12:27, Michael Fryars<fr...@gmail.com> wrote:
> Axis2 v1.4.1, running in a WAR in a tomcat 6 container.
>
> On Fri, Aug 14, 2009 at 12:20 PM, Andreas Veithen
> <an...@gmail.com> wrote:
>>
>> Which version of Axis2 do you use?
>>
>> Andreas
>>
>> On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com> wrote:
>> > Hello,
>> > I'm seeking some advice/help with a character encoding problem with an
>> > axis2
>> > service (i.e. server side).
>> >
>> > When my service receives a (WS/SOAP) request with:
>> > Content-Type: text/xml; charset=UTF-8
>> > in the HTTP header, everything works fine, any unusual charcters in the
>> > response are correctly encoded in UTF-8.
>> >
>> > But when the service receives a request with:
>> > Content-Type: text/xml; charset=ISO-8859-1
>> > the response is inconsistent. The response is labelled as ISO-8859-1:
>> > Content-Type: text/xml; charset=ISO-8859-1
>> > <?xml version="1.0" encoding="ISO-8859-1"?>
>> > but in fact the message body is still encoded in UTF-8.
>> >
>> > Should the axis2 engine automatically select and use ISO-8859-1 encoding
>> > for
>> > the response? Or is it something I need to configure? Or is it always
>> > UTF-8?
>> >
>> > I understood from a previous thread ("How to change Axis2 response
>> > character
>> > encoding") that axis2 selects a a message builder based on the
>> > Content-Type
>> > header. My axis2.xml config does not contain anything specifically for
>> > "text/xml" :
>> >
>> > <messageBuilders>
>> > <messageBuilder contentType="application/xml"
>> >
>> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>> > <messageBuilder contentType="application/xml"
>> >
>> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
>> > <messageBuilder contentType="application/x-www-form-urlencoded"
>> >
>> > class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
>> > <messageBuilder contentType="multipart/form-data"
>> >
>> > class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
>> > </messageBuilders>
>> >
>> > Is this where I need to intervene to control the response encoding?
>> >
>> > Thanks in advance for any help you can provide.
>> >
>> > Michael Fryars
>> >
>
>
Re: [AXIS2] Control character encoding used by axis2 server for
responses
Posted by Michael Fryars <fr...@gmail.com>.
Axis2 v1.4.1, running in a WAR in a tomcat 6 container.
On Fri, Aug 14, 2009 at 12:20 PM, Andreas Veithen <andreas.veithen@gmail.com
> wrote:
> Which version of Axis2 do you use?
>
> Andreas
>
> On Fri, Aug 14, 2009 at 11:39, Michael Fryars<fr...@gmail.com> wrote:
> > Hello,
> > I'm seeking some advice/help with a character encoding problem with an
> axis2
> > service (i.e. server side).
> >
> > When my service receives a (WS/SOAP) request with:
> > Content-Type: text/xml; charset=UTF-8
> > in the HTTP header, everything works fine, any unusual charcters in the
> > response are correctly encoded in UTF-8.
> >
> > But when the service receives a request with:
> > Content-Type: text/xml; charset=ISO-8859-1
> > the response is inconsistent. The response is labelled as ISO-8859-1:
> > Content-Type: text/xml; charset=ISO-8859-1
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > but in fact the message body is still encoded in UTF-8.
> >
> > Should the axis2 engine automatically select and use ISO-8859-1 encoding
> for
> > the response? Or is it something I need to configure? Or is it always
> UTF-8?
> >
> > I understood from a previous thread ("How to change Axis2 response
> character
> > encoding") that axis2 selects a a message builder based on the
> Content-Type
> > header. My axis2.xml config does not contain anything specifically for
> > "text/xml" :
> >
> > <messageBuilders>
> > <messageBuilder contentType="application/xml"
> >
> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> > <messageBuilder contentType="application/xml"
> >
> > class="org.apache.axis2.builder.ApplicationXMLBuilder"/>
> > <messageBuilder contentType="application/x-www-form-urlencoded"
> >
> > class="org.apache.axis2.builder.XFormURLEncodedBuilder"/>
> > <messageBuilder contentType="multipart/form-data"
> >
> > class="org.apache.axis2.builder.MultipartFormDataBuilder"/>
> > </messageBuilders>
> >
> > Is this where I need to intervene to control the response encoding?
> >
> > Thanks in advance for any help you can provide.
> >
> > Michael Fryars
> >
>