Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tomas-Kraus opened this issue Jun 2, 2022 · 0 comments
Open

Comments

@Tomas-Kraus
Copy link
Member

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)

Source: javaee/metro-jax-ws#1211
Author: matthew-firth

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

No branches or pull requests

1 participant