Issue
I am migrating my application to Java 11 and Tomcat 9 from Java 8 and Tomcat 7. With some version updates, minor implementation changes and adding few maven dependencies, I have been able to successfully compile and run my application. However, I have few integration tests written to test the Soap based webservices in my application which are failing. This is happening due to mismatch in the expected Soap response and the actual response.
Here are the two responses: Actual is :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<S:Envelope
xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<S:Body
xmlns:ns2="http://www.acd.org/cact/namespaces/StandardBusinessDocumentHeader"
xmlns:ns3="urn:global:cpci-query:xsd:1"
xmlns:ns4="urn:global:cpci-masterdata:xsd:1"
xmlns:ns5="urn:global:cpci:xsd:1">
<ns3:GetResult>
<string>SimpleDataQuery</string>
<string>SimpleQuery</string>
</ns3:GetResult>
</S:Body>
</S:Envelope>
Expected is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns5:GetResult
xmlns:ns5="urn:global:cpci-query:xsd:1">
<string>SimpleQuery</string>
<string>SimpleDataQuery</string>
</ns5:GetResult>
</soapenv:Body>
</soapenv:Envelope>
The pom has following updated entries :
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
Can there be any impact of Java 11 on WS responses' elements order being disturbed ? If yes, then is this due to some outdated dependencies or we need to modify some implementations?
Solution
Update : Apparently the issue was due to rt.jar and jaxws-rt.jar missing in the new JDKs. Adding these dependencies doesn't solve the problem totally as their transitive are not available due to non compilation of their pom.xml. Adding all the required transitive dependencies in the maven solved the issue.
Answered By - Aditya Batra
Answer Checked By - Willingham (JavaFixing Volunteer)