My application is connecting to a web service rpc/encoded. Im using Axis 1.4.
When the webservice sends a response, it sends an invalid character then an exception:
http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException:
An invalid XML character (Unicode: 0x3) was found in the element content of the document.
The xml encoding is “ISO-8859-1”. I think that is the problem.
My question is: Is there any configuration that i can make in my application to accept this invalid character ?
I solved the problem putting a method inside org.apache.axis.handlers.LogHandler to search and destroy illegal characters before parse the the content inside xml response ahead.
To create your own LogHandler
The method to search and destroy illegal characters
Inside logMessages method of your new LogHandler put the following:
private void logMessages(MessageContext msgContext) throws AxisFault {
...
msgContext.setResponseMessage(new Message(
stripNonValidXMLCharacters(((Message) msgContext
.getResponseMessage()).getSOAPPartAsString())));
...
}