Question

I am trying to deploy a spring-ws SOAP webservice in JBoss 4.2 (JDK 1.6, spring 3.0, spring-ws 2.0). I am using JAXB2 as O/X binding. Setup is fine, beans found and wired, requests can be sent and responses are generated. However, I am getting empty responses. It neither is in a SOAP envelope nor contains my simple UserDetails any content that is assembled on the server.

The correct response would be:

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header/>
    <SOAP-ENV:Body>
       <ns2:UserDetails xmlns:ns2="http://a.dol.com/schemas">
          <ns2:name>John</ns2:name>
          <ns2:lastname>PerX</ns2:lastname>
       </ns2:UserDetails>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

But I just get something like:

<Envelope>
    <Header/>
    <Body>
       <ns2:UserDetails xmlns:ns2="http://a.dol.com/schemas"/>
   </Body>
</Envelope>

After searching google, I found the following code to be added:

<beans>
  <!-- Big magic hack to fix the broken SAAJ in JBoss
   See http://static.springsource.org/spring-ws/sites/1.5/faq.html#saaj-jboss -->
   <bean id="messageFactory">
     <property name="messageFactory">
       <!-- This is the Java 6 variant of this fix! Note the "internal" package missing in the spring-ws FAQ. -->
       <bean class="com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
     <property>
   <bean/>
</beans>

But this also doesnt help, I get the folloiwng error:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageFactory' defined in ServletContext resource...

Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError...
    Caused by: java.lang.IllegalArgumentException: com.sun.xml.messaging.saaj.soap.LocalStrings != com.sun.xml.internal.messaging.saaj.soap.LocalStrings

Any hints appreciated.

Updated

Updating the run.bat for JBoss with the following does fix the problem, but is this the correct way of doing it??

set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.SOAPConnectionFactory=com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory
set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
Was it helpful?

Solution 2

Updating the run.bat for JBoss with the following does fix the problem:

set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.SOAPConnectionFactory=com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory
set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
set JAVA_OPTS=%JAVA_OPTS% -Djavax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl

OTHER TIPS

Replace the spring snippet with

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    <property name="messageFactory">
        <bean class="com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl"/>
    </property>
</bean>

You have left out the fully qualified classname in the messageFactory bean definition. This should work then without the startup options.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top