views:

275

answers:

2

We use Axis2 to generate web service response of which the body is a xml message that generated from a system using windows 1252 as encoding. Our Axis2 system, will wrapped this body inside a soap message using utf8. The message is then send to the caller. However, the caller keep reject the message with "Invalid byte 1 of 1-byte UTF-8"

The caller system suggest me to take out the encoding attribute in the xml declare of the response. I do not know how to tell axis not to put this setting. Any one know how?

A: 

It's probably best to keep the Axis response as UTF-8, and instead try to alter the encoding of the payload from 1252 to UTF-8. How are you assembling the SOAP response from the payload?

skaffman
A: 

Is the original XML's encoding correctly declared as Windows-1252 in the XML header? If not, it's not really XML and that system is broken; if it is declared and Axis2 just relabels it as UTF-8 without actually converting the data, then Axis2 is (very badly) broken.

In either case, fix the broken system. Do NOT remove the encoding - that's the worst thing you can do. As indicated above: XML without a declared encoding is not XML, it's random data that might look vaguely like XML.

Michael Borgwardt