[SWS-816] Missing encoding in dom4j element/document Created: 05/Dec/12  Updated: 09/Apr/13  Resolved: 09/Apr/13

Status: Resolved
Project: Spring Web Services
Component/s: Core
Affects Version/s: None
Fix Version/s: 2.1.3

Type: Bug Priority: Minor
Reporter: Lino Cibran Assignee: Arjen Poutsma
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


I'm using spring-ws 2.1.0.RELEASE, my webservice has @RequestPayload on a dom4j element. It appears that the dom4j element has no encoding set: the method element.getDocument().getXMLEncoding() returns null.

How do I know what encoding was used sending in the request? Is there a way I can force conversion to an encoding such as UTF-8?

The incoming request (I'm using SOAPUI for testing) shows it transfers ContenType: text/xml;charset=UTF-8, but it's not picked up when creating the Element. Isn't this an issue, or should the dom4j Element be changed to a Document? How do I do that, it appears it's not supported (yet).

Comment by Arjen Poutsma [ 09/Apr/13 ]

The underlying issue seems to be a DOM4J issue, as Spring-WS is using the functionality provided in DOM4J to convert the incoming XML request into a DOM4J. DOM4J just doesn't seem to pick up the encoding during that conversion process.

If you would like to know the character encoding of the incoming message, you can always use the TransportContext to get to it: see ws/site/reference/html/common.html#transport-context.

Generated at Tue Nov 20 21:37:21 UTC 2018 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.