In my previous post (here) I described how to combine Spring WS with StAX parsing the SOAP messages. I ended with generating the WSDL as a test and said you could use Soap UI for testing the web service.
Well, I did. And I was running into the following error when I had deployed my web service at JBoss4.0.5.GA:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Header/> <env:Body> <env:Fault> <faultcode>env:Server</faultcode> <faultstring>Operation only supported for javax.xml.soap.Node, this is a [#comment: Test comment]</faultstring> </env:Fault> </env:Body> </env:Envelope>
I fixed the issue by adding the following dependencies to the project’s pom.xml:
<dependency> <groupId>com.sun.xml.messaging.saaj</groupId> <artifactId>saaj-impl</artifactId> <version>1.3</version> </dependency> <dependency> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> <version>1.1</version> <scope>provided</scope> </dependency>
If I don’t add this dependencies, apparently Spring WS is using the JBossWS libraries as default, and these libraries can’t handle the StAX parsing/writing abilities of Spring WS.
So, after adding the necessary dependencies and redeploying the web service I got the expected response:
<soap-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <soap-ENV:Header/> <soap-ENV:Body> <hr:HolidayResponse xmlns:hr="http://www.redstream.nl/hr/schemas"> <!--Test comment--> <hr:Status>APPROVED</hr:Status> </hr:HolidayResponse> </soap-ENV:Body> </soap-ENV:Envelope>
I don’t know about other J(2)EE Servers but for this JBoss version you need these dependencies to get it working.