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

saaj-impl 1.5.3 regression when cloning a document #184

Open
fpavageau opened this issue Jul 20, 2021 · 1 comment
Open

saaj-impl 1.5.3 regression when cloning a document #184

fpavageau opened this issue Jul 20, 2021 · 1 comment

Comments

@fpavageau
Copy link

Context

In a Spring WS context, I have an integration test which fails when saaj-impl is upgraded from 1.5.2 to 1.5.3, because the mock server fails to match the actual request with the expected request. That part is done by spring-ws-test using xmlunit, which clones the incoming SOAPDocument to be able to normalize it against the expected request. With 1.5.3, xmlunit fails to use the cloned document, as it throws an IllegalArgumentException with Cannot find SOAP wrapper for element [SOAP-ENV:Envelope: null]:

java.lang.IllegalArgumentException: Cannot find SOAP wrapper for element [SOAP-ENV:Envelope: null]
	at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.find(SOAPDocumentImpl.java:590)
	at com.sun.xml.messaging.saaj.soap.SOAPDocumentImpl.find(SOAPDocumentImpl.java:578)
	at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.lookForEnvelope(SOAPPartImpl.java:155)
	at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl.java:135)
	at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getDocumentElement(SOAPPartImpl.java:430)
	at org.custommonkey.xmlunit.DifferenceEngine.compareNode(DifferenceEngine.java:191)
	at org.custommonkey.xmlunit.DifferenceEngine.compare(DifferenceEngine.java:130)
	at org.custommonkey.xmlunit.Diff.compare(Diff.java:241)
	at org.custommonkey.xmlunit.Diff.appendMessage(Diff.java:364)
	at org.custommonkey.xmlunit.Diff.toString(Diff.java:378)
	at org.springframework.ws.test.support.matcher.SoapEnvelopeDiffMatcher.match(SoapEnvelopeDiffMatcher.java:61)
	at org.springframework.ws.test.support.matcher.AbstractSoapMessageMatcher.match(AbstractSoapMessageMatcher.java:40)
	at org.springframework.ws.test.client.WebServiceMessageMatcherAdapter.match(WebServiceMessageMatcherAdapter.java:43)
	at org.springframework.ws.test.client.MockSenderConnection.send(MockSenderConnection.java:76)
	at org.springframework.ws.client.core.WebServiceTemplate.sendRequest(WebServiceTemplate.java:658)
	at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:606)
	at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555)
	at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390)

Analysis

The difference in behavior between 1.5.2 and 1.5.3 comes from #166, which changes SOAPPartImpl.cloneNode() to call the doCloneNode() method: the cloned SOAPPartImpl instance has no envelope set, and it then fails to re-create it (when getEnvelope() is called, in the stacktrace above), apparently because the owner document misses some userData.

Reproducing the issue

I'll try to create a simple project reproducing the issue:

  1. create a SoapMessage
  2. get its document (the SOAPPart) and clone it
  3. call getDocumentElement() on the clone and fail
@sephiroth-j
Copy link
Contributor

relates to spring-projects/spring-ws#1193

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

2 participants