Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XML encoding or escaping of SOAP message

843833Sep 17 2007 — edited Mar 10 2008
We are running into a problem where our generated SOAP XML contains non-UTF8 characters. These characters are not properly escaped and the XML encoding tag is set to:

<?xml version="1.0" ?>

Clients thus assume the encoding is UTF-8 which in turn causes the following exception to be thrown:

javax.xml.ws.WebServiceException: javax.xml.bind.UnmarshalException
- with linked exception:
[javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,38912]
Message: An invalid XML character (Unicode: 0x1a) was found in the element content of the document
.]
at com.sun.xml.ws.encoding.soap.client.SOAPXMLDecoder.toInternalMessage(SOAPXMLDecoder.jav
a:274)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.receive(SOAPMessageDispatcher
.java:534)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.doSend(SOAPMessageDispatcher.
java:258)
at com.sun.xml.ws.protocol.soap.client.SOAPMessageDispatcher.send(SOAPMessageDispatcher.ja
va:137)
at com.sun.xml.ws.encoding.soap.internal.DelegateBase.send(DelegateBase.java:84)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.implementSEIMethod(EndpointIFInvocati
onHandler.java:172)
at com.sun.xml.ws.client.EndpointIFInvocationHandler.invoke(EndpointIFInvocationHandler.ja
va:106)
at $Proxy16.getMerchantListings(Unknown Source)


Is there a way to configure JAX-WS (or JAXB) to escape non-UTF-8 characters? Or a way to configure JAX-WS (or JAXB) to have the proper character encoding set in the XML encoding tag?

Thanks for your help,

Peter
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2008
Added on Sep 17 2007
2 comments
3,582 views