Using StAX Parsing with JBoss4.0.5.GA

In my former 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:

1
2
3
4
5
6
7
8
9
<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:

1
2
3
4
5
6
7
8
9
10
11
<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:

1
2
3
4
5
6
7
8
9
<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.

tags: ,

About Pascal Alma

Pascal started as an Oracle Developer in 1997 and developed numerous applications with Oracle Designer/Developer and PL/SQL. Since 2001 Pascal becomes more and more active with the development of software at the Java/J2EE platform. Nowadays Pascal is a senior JEE Developer/ Architect and has a lot of experience with several open source initiatives/ frameworks especially within the Enterprise Integration area. Besides these technical skills Pascal is a big Scrum enthusiastic.

Comments are closed.