Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

JAX-WS spec non-compliance when parsing a pretty-printed SOAP fault #1211

Open
matthew-firth opened this issue Feb 18, 2018 · 0 comments
Open

Comments

@matthew-firth
Copy link

JAX-WS throws SOAPExceptionImpl when attempting to parse a SOAP fault that has been pretty-printed.

The code in com.sun.xml.messaging.saaj.soap.ver1_2.Fault1_2Impl.addTextNode() unilaterally throws an exception on invocation. It should only do that after a whitespace check such as "!text.trim().isEmpty()".

A colleague pointed me to a section of the SOAP spec that indicates JAX-WS's behaviour is not correct:
https://www.w3.org/TR/soap12/#soapenv

Element information items defined by this specification that only have element information items defined as allowable members of their [children] property can also have zero or more character information item children. The character code of each such character information item MUST be amongst the white space characters as defined by XML 1.0 [XML 1.0]. Unless otherwise indicated, such character information items are considered insignificant.

Sample stack trace is below:

com.sun.xml.messaging.saaj.SOAPExceptionImpl: Adding text to SOAP 1.2 Fault is not legal
	at com.sun.xml.messaging.saaj.soap.ver1_2.Fault1_2Impl.addTextNode(Fault1_2Impl.java:521)
	at com.sun.xml.ws.api.message.saaj.SaajStaxWriter.writeCharacters(SaajStaxWriter.java:286)
	at org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter.handleCharacters(XMLStreamReaderToXMLStreamWriter.java:204)
	at org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter.bridge(XMLStreamReaderToXMLStreamWriter.java:145)
	at org.jvnet.staxex.util.XMLStreamReaderToXMLStreamWriter.bridge(XMLStreamReaderToXMLStreamWriter.java:99)
	at com.sun.xml.ws.message.stream.StreamMessage.writePayloadTo(StreamMessage.java:416)
	at com.sun.xml.ws.message.stream.StreamMessage.writeEnvelope(StreamMessage.java:462)
	at com.sun.xml.ws.message.stream.StreamMessage.writeTo(StreamMessage.java:431)
	at com.sun.xml.ws.api.message.MessageWrapper.writeTo(MessageWrapper.java:226)
	at com.sun.xml.ws.api.message.saaj.SAAJFactory.readAsSOAPMessage(SAAJFactory.java:285)
	at com.sun.xml.ws.api.message.saaj.SAAJFactory.readAsSAAJ(SAAJFactory.java:212)
	at com.sun.xml.ws.api.message.saaj.SAAJFactory.read(SAAJFactory.java:201)
	at com.sun.xml.ws.message.AbstractMessageImpl.toSAAJ(AbstractMessageImpl.java:236)
	at com.sun.xml.ws.api.message.MessageWrapper.readAsSOAPMessage(MessageWrapper.java:176)
	at com.sun.xml.ws.handler.SOAPMessageContextImpl.getMessage(SOAPMessageContextImpl.java:85)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant