Announcement Announcement Module
Collapse
No announcement yet.
Echo response missing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Echo response missing

    hi,

    I new to Spring WS. I have deployed the Echo sample in JBoss and am able to communicate with it from my client. However the soap response from the web service is missing the text content "hello" when I call the web service deployed on JBoss 4.2.0. It works fine in Tomcat 5.5. I have added the latest xercesimpl.jar, xalan.jar and serializer.jar to the war, since I read somewhere that these files in JBoss could cause conflicts. But the problem still persists. Please advice.

    The response I get is
    <?xml version="1.0" encoding="UTF-8"?><echoResponse xmlns="http://www.springframework.org/spring-ws/samples/echo"/>

    Thanks,
    Seema

  • #2
    JBoss' implementation of SAAJ (the underlying J2EE library used by Spring-WS) has some issues. See this thread for a work around.

    Comment


    • #3
      JBoss-SpringWS problem

      Thanks, Arjen. As mentioned in that post, I tried to add this section to my spring -ws-servlet.xml.
      Code:
      <bean id="messageFactory"
      class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
      <bean id="messageContextFactory" 
      class="org.springframework.ws.soap.saaj.SaajSoapMessageContextFactory">
      <property name="messageFactory" ref="messageFactory" />
      </bean>
      <bean id="messageEndpointHandlerAdapter"
      class="org.springframework.ws.transport.http.MessageEndpointHandlerAdapter">
      <property name="messageContextFactory" ref="messageContextFactory"/>
      </bean>
      But now I'm getting another error.
      Exception in thread "main" org.springframework.ws.soap.SoapMessageCreationExc eption: Could not create message from InputStream: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?; nested exception is com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
      Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionI mpl: Invalid Content-Type:text/html. Is this an error message instead of a SOAP response?
      at com.sun.xml.internal.messaging.saaj.soap.MessageIm pl.identifyContentType(Unknown Source)
      at com.sun.xml.internal.messaging.saaj.soap.MessageIm pl.<init>(Unknown Source)
      at com.sun.xml.internal.messaging.saaj.soap.ver1_1.Me ssage1_1Impl.<init>(Unknown Source)
      at com.sun.xml.internal.messaging.saaj.soap.ver1_1.SO APMessageFactory1_1Impl.createMessage(Unknown Source)
      at org.springframework.ws.soap.saaj.SaajSoapMessageFa ctory.createWebServiceMessage(SaajSoapMessageFacto ry.java:155)
      at org.springframework.ws.transport.AbstractWebServic eConnection.receive(AbstractWebServiceConnection.j ava:50)
      at org.springframework.ws.client.core.WebServiceTempl ate.receiveResponse(WebServiceTemplate.java:404)
      at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:359)
      at org.springframework.ws.client.core.WebServiceTempl ate.doSendAndReceive(WebServiceTemplate.java:310)
      at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:255)
      at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:246)
      at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:236)
      at org.springframework.ws.samples.echo.client.sws.Ech oClient.echo(EchoClient.java:40)
      at org.springframework.ws.samples.echo.client.sws.Ech oClient.main(EchoClient.java:48)

      Please advice.

      Thanks,
      Seema

      Comment


      • #4
        It seems like whatever is sent to the server is not XML, but text/html. You can use something like https://tcpmon.dev.java.net/ to find out what is sent to the server.

        Comment


        • #5
          I used tcpmon to capture the messages, like you suggested. This is the message getting sent from the echo client.

          POST /EchoServer HTTP/1.1
          Accept-Encoding: gzip
          Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
          Content-Type: text/xml; charset=utf-8
          Content-Length: 241
          Cache-Control: no-cache
          Pragma: no-cache
          User-Agent: Java/1.6.0_01
          Host: localhost:7001
          Connection: keep-alive

          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">Hello</echoRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>

          Is this correct? This is the same echo client that comes in the samples folder, I have not modified any code in it. But I could not find the jar files for the client, the lib folder in the client was empty. Maybe something is wrong with the jar files I have? Can you tell me where I can download the correct jar files for the client?

          Thanks
          Seema

          Comment


          • #6
            The client should run out of the box, the lib folder is no longer necessary. As a matter of fact, it's not even there in RC2. Are you using RC2?

            Comment


            • #7
              Downloaded RC2,but same problem

              hi Arjen,

              I have downloaded RC2 and replaced my files, but the result is the same. Here is the SOAP request that is sent from the client.
              Code:
              POST /EchoServer HTTP/1.1
              Accept-Encoding: gzip
              Accept: text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
              Content-Type: text/xml; charset=utf-8
              Content-Length: 241
              Cache-Control: no-cache
              Pragma: no-cache
              User-Agent: Java/1.6.0_01
              Host: localhost:7001
              Connection: keep-alive
              
              <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><echoRequest xmlns="http://www.springframework.org/spring-ws/samples/echo">Hello</echoRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>
              The response from the server seems to have junk characters.
              Code:
              HTTP/1.1 200 OK
              Server: Apache-Coyote/1.1
              X-Powered-By: Servlet 2.4; JBoss-4.2.0.GA (build: SVNTag=JBoss_4_2_0_GA date=200705111440)/Tomcat-5.5
              Content-Type: text/xml;charset=UTF-8
              Transfer-Encoding: chunked
              Date: Tue, 19 Jun 2007 01:50:11 GMT
              
              b4
              <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'><env:Header></env:Header><env:Body><echoResponse xmlns='http://www.springframework.org/spring-ws/samples/echo'/>
              1a
              </env:Body></env:Envelope>
              0
              Please let me know the work around for this problem. If you have a WAR file that works in JBoss, can I download it and use the same settings?

              Thanks,
              Seema

              Comment


              • #8
                AH, right, so the problem is on the client side, I didn't get that earlier. One more thing you could try is to use the CommonsHttpMessageSender instead of the default HttpUrlConnectionMessageSender. Just set the message sender bean on the template, there is a property for it.

                Or if you create a JIRA issue, I will try and reproduce it.

                Comment


                • #9
                  Why do you say that the problem is at the client end? The response from the server has junk characters, right? Morover, I tried with other clients as well. Anyway, I will try what you suggested.

                  Thanks,
                  Seema

                  Comment


                  • #10
                    I'm not sure what you mean by the message sender bean? Can you elaborate on which bean's settings I need to modify?

                    Thanks,
                    Seema

                    Comment


                    • #11
                      I tried to reproduce this, but ended up with a different error. The way I made it work was to add the following to echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml:

                      Code:
                      <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
                          <property name="messageFactory">
                              <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
                          </property>
                      </bean>
                      I did a mvn package after that, and copied the target/echo.war to jboss-4.2.0.GA/server/default/deploy/. Let me know if this solution works for you. Both clients (saaj and spring-ws) work with this setup.

                      I'll add an entry to the FAQ about this.

                      Comment


                      • #12
                        Thanks, Arjen
                        I added this to my file and had to put two more jar files in my path - appserv-rt.jar and saaj-impl.jar.
                        Now it works fine. Please do add this information in the faq for the benefit of others.

                        Seema

                        Comment


                        • #13
                          Originally posted by Arjen Poutsma View Post
                          I tried to reproduce this, but ended up with a different error. The way I made it work was to add the following to echo/src/main/webapp/WEB-INF/spring-ws-servlet.xml:

                          Code:
                          <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMessageFactory">
                              <property name="messageFactory">
                                  <bean class="com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl" />
                              </property>
                          </bean>
                          I did a mvn package after that, and copied the target/echo.war to jboss-4.2.0.GA/server/default/deploy/. Let me know if this solution works for you. Both clients (saaj and spring-ws) work with this setup.

                          I'll add an entry to the FAQ about this.
                          Worked like a charm. Thanks so much!

                          Comment

                          Working...
                          X