I have a web service and client that are passing around strings containing character references such as  (0x1A). These are invalid in XML 1.0 but valid in XML 1.1. Axis's XML parser is throwing exceptions because of these character references. Is there a way to force it to parse the response as XML 1.1, or to insert the XML declaration? (There currently isn't one.) I looked into using handlers, but my understanding is that they get invoked after the XML is already parsed.
I think you're going to have a pretty tough time with this. My understanding is that the WSDL 2.0 standard is built on XML 1.0. So what kind of service are you calling that describes itself with WSDL (assuming XML 1.0) and then starts sending you messages with XML 1.1 characters in it?
When you define an Axis2 service, you can define what handlers it has in the services.xml file. For example on this page they've got a service that used the org.apache.axis2.receivers.RawXMLINOutMessageReceiver...I know that's not what you're trying to do but maybe it's a place to start looking or thinking.
Are you passing in an InputStream
or Reader
? If so, you could wrap the source in another class (like BufferedReader
works) but use it to drop the unnecessary characters.