0

I am new to Spring-WS and I had to create a WebService for my project. So to try some examples, I downloaded spring-webservices-samples from http://code.google.com/p/spring-webservices-samples/

When I deploy the war file and test using SoapUI; I am getting weird characters (like ce,1a,0 ) in the response message and the "CalculateResponse" element is empty.

    <ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/> 

And there is no exceptions. I tried to debug but no luck.

Please help me with the issue. I really appreciate any input.

I am using JBoss 4.2.3, Java 1.6 (64 bit).

I tried deploying the same war file in Tomcat-7.0.29 and it works. But I have to get my WebService working in JBoss 4.2.3

Request Captured using TCPMon:

    POST /annotated-payload-endpoint/calculatorService HTTP/1.1
    Accept-Encoding: gzip,deflate
    Content-Type: text/xml;charset=UTF-8
    SOAPAction: "http://www.marvelution.com/samples/definitions/CalculatorService/Add"
    Content-Length: 377
    Host: 127.0.0.1:9999
    Connection: Keep-Alive
    User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cal="http://www.marvelution.com/samples/schemas/CalculatorServiceSchema">
       <soapenv:Header/>
       <soapenv:Body>
          <cal:Add>
             <!--2 or more repetitions:-->
             <cal:number>1</cal:number>
             <cal:number>2</cal:number>
          </cal:Add>
       </soapenv:Body>
    </soapenv:Envelope>

Response Captured using TCPMon:

    HTTP/1.1 200 OK
    Server: Apache-Coyote/1.1
    X-Powered-By: Servlet 2.4; JBoss-4.2.3.GA (build: SVNTag=JBoss_4_2_3_GA date=200807181417)/JBossWeb-2.0
    SOAPAction: ""
    Content-Type: text/xml;charset=UTF-8
    Transfer-Encoding: chunked
    Date: Fri, 20 Jul 2012 01:47:23 GMT

    ce
    <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><ns2:CalculateResponse xmlns:ns2='http://www.marvelution.com/samples/schemas/CalculatorServiceSchema'/>
    1a
    </env:Body></env:Envelope>
    0

Endpoint: CalculatorEndpoint.java

    @PayloadRoot(namespace = "http://www.marvelution.com/samples/schemas/CalculatorServiceSchema", localPart = "Add")
    public CalculateResponse add(Add numbers) {
        CalculateResponse res = wrapResult(calculator.add(numbers.getNumber()));
        System.out.println("Response before sending:"+res.getResult());
        return res;
    }

The System.out.println right before returning the response is getting printed. I am not sure where these characters are getting added and why the response is incomplete.

Thanks, Jeg

Jeg
  • 1
  • 3

1 Answers1

0

I found out what the issue was. The SAAJ implementation provided by JBoss has some issues. (i.e. This Default JBoss implementation "org.jboss.ws.core.soap.MessageFactoryImpl" has issues) The solution is therefore not to use the JBoss implementation, but to use another implementation.

Example: Use one of the following implementation: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessage Factory1_1Impl org.apache.axis2.saaj.MessageFactoryImpl

<bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
    <property name="messageFactory">
        <bean class="org.apache.axis2.saaj.MessageFactoryImpl"/>
    </property>
</bean>

This issue already reported here: URL: http://static.springsource.org/sprin...tml#saaj-jboss

Jeg
  • 1
  • 3