JBoss Web Services
  1. JBoss Web Services
  2. JBWS-3424

CXF does not return status code 202 when Oneway webservice is invoked via HTTP

    Details

    • Similar Issues:
      Show 10 results 

      Gliffy Diagrams

        Issue Links

          Activity

          Hide
          Alessio Soldano added a comment -

          Hi Jim, can you please check this? Thanks

          Show
          Alessio Soldano added a comment - Hi Jim, can you please check this? Thanks
          Hide
          Tomohisa igarashi added a comment -

          Hi,
          This is a reproducer that publish&invoke a web service using Endpoint. I got correct HTTP 202 response when I run it under JDK, but I didn't got any status code when I run it with the option: -Djavax.xml.ws.spi.Provider=org.jboss.wsf.stack.cxf.client.ProviderImpl

          Show
          Tomohisa igarashi added a comment - Hi, This is a reproducer that publish&invoke a web service using Endpoint. I got correct HTTP 202 response when I run it under JDK, but I didn't got any status code when I run it with the option: -Djavax.xml.ws.spi.Provider=org.jboss.wsf.stack.cxf.client.ProviderImpl
          Hide
          Jim Ma added a comment -

          JBossWS-CXF expects the following request and respond with 200 OK:
          ==== Request ====
          POST /context/test HTTP/1.1
          Content-Length: 186
          Content-Type: text/xml; charset=utf-8
          Host: 127.0.0.1:18000

          <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
          <soap:Body>
          <test:input xmlns:test="urn:test">foobar</test:input>
          </soap:Body>
          </soap:Envelope>

          ==== Response ====
          HTTP/1.1 200 OK
          Content-Type: text/xml;charset=UTF-8
          Content-Length: 132
          Server: Jetty(7.5.4.v20111024)

          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body/></SOAP-ENV:Envelope>
          ==============

          To send this right format of request, I changed the code which send the request and it works:

          Socket sock = new Socket("localhost", 18000);
          BufferedReader reader = new BufferedReader(new InputStreamReader(sock.getInputStream()));
          Thread t = new MyReader(reader);
          t.start();
          OutputStream out = sock.getOutputStream();
          String method = "POST /context/test HTTP/1.1\r\n";
          out.write(method.getBytes(), 0, method.getBytes().length);
          String contentLength = "Content-Length: " + REQUEST_BODY.length() + "\r\n";
          out.write(contentLength.getBytes(), 0, contentLength.getBytes().length);

          //only need one \r\n
          >> String contentType = "Content-Type: text/xml; charset=\"utf-8\"\r\n";
          out.write(contentType.getBytes(), 0, contentType.getBytes().length);

          //add host header
          >> String host = "Host: 127.0.0.1:18080\r\n";
          >> out.write(host.getBytes(), 0, host.getBytes().length);

          //add new line
          >> String cr = "\r\n";

          out.write(cr.getBytes(), 0, cr.getBytes().length);
          out.write(REQUEST_BODY.getBytes(), 0, REQUEST_BODY.getBytes().length);
          String eof = "\r\n\r\n";
          out.write(eof.getBytes(), 0, eof.getBytes().length);
          out.flush();
          Thread.sleep(1000);
          sock.close();

          Show
          Jim Ma added a comment - JBossWS-CXF expects the following request and respond with 200 OK: ==== Request ==== POST /context/test HTTP/1.1 Content-Length: 186 Content-Type: text/xml; charset=utf-8 Host: 127.0.0.1:18000 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <test:input xmlns:test="urn:test">foobar</test:input> </soap:Body> </soap:Envelope> ==== Response ==== HTTP/1.1 200 OK Content-Type: text/xml;charset=UTF-8 Content-Length: 132 Server: Jetty(7.5.4.v20111024) <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body/></SOAP-ENV:Envelope> ============== To send this right format of request, I changed the code which send the request and it works: Socket sock = new Socket("localhost", 18000); BufferedReader reader = new BufferedReader(new InputStreamReader(sock.getInputStream())); Thread t = new MyReader(reader); t.start(); OutputStream out = sock.getOutputStream(); String method = "POST /context/test HTTP/1.1\r\n"; out.write(method.getBytes(), 0, method.getBytes().length); String contentLength = "Content-Length: " + REQUEST_BODY.length() + "\r\n"; out.write(contentLength.getBytes(), 0, contentLength.getBytes().length); //only need one \r\n >> String contentType = "Content-Type: text/xml; charset=\"utf-8\"\r\n"; out.write(contentType.getBytes(), 0, contentType.getBytes().length); //add host header >> String host = "Host: 127.0.0.1:18080\r\n"; >> out.write(host.getBytes(), 0, host.getBytes().length); //add new line >> String cr = "\r\n"; out.write(cr.getBytes(), 0, cr.getBytes().length); out.write(REQUEST_BODY.getBytes(), 0, REQUEST_BODY.getBytes().length); String eof = "\r\n\r\n"; out.write(eof.getBytes(), 0, eof.getBytes().length); out.flush(); Thread.sleep(1000); sock.close();
          Hide
          Tomohisa igarashi added a comment -

          Thanks Jim,

          I'll also try your suggestion but this is Oneway service so I think HTTP status code 200 and having body is still wrong behavior, is that right? It should return the response with HTTP status 202 and Content-length=0.

          Show
          Tomohisa igarashi added a comment - Thanks Jim, I'll also try your suggestion but this is Oneway service so I think HTTP status code 200 and having body is still wrong behavior, is that right? It should return the response with HTTP status 202 and Content-length=0.
          Hide
          Tomohisa igarashi added a comment -

          I couldn't get any HTTP status code, header nor body even if I added Host header. After a slight look with debugger, I'm not sure but, OutgoingChainInterceptor and some others seems to be passed to another thread by OnewayProcessorInterceptor. So is there a possibility to have timing issue?

          I have following dependencies that is same as AS7.1.0.CR1b:

          • wsdl4j-1.6.2.jar
          • xmlschema-core-2.0.jar
          • apache-cxf-2.4.4
          • httpserver-1.0.0.Beta3 (org.jboss.com.sun.httpserver)
          • jaxws-jboss-httpserver-httpspi-1.0.0.GA
          • jboss-jaxws-api_2.2_spec-2.0.0.Final
          • jbossws-common-2.0.0.GA
          • jbossws-cxf-4.0.0.GA
          Show
          Tomohisa igarashi added a comment - I couldn't get any HTTP status code, header nor body even if I added Host header. After a slight look with debugger, I'm not sure but, OutgoingChainInterceptor and some others seems to be passed to another thread by OnewayProcessorInterceptor. So is there a possibility to have timing issue? I have following dependencies that is same as AS7.1.0.CR1b: wsdl4j-1.6.2.jar xmlschema-core-2.0.jar apache-cxf-2.4.4 httpserver-1.0.0.Beta3 (org.jboss.com.sun.httpserver) jaxws-jboss-httpserver-httpspi-1.0.0.GA jboss-jaxws-api_2.2_spec-2.0.0.Final jbossws-common-2.0.0.GA jbossws-cxf-4.0.0.GA
          Hide
          Jim Ma added a comment -

          These jar version info is great helpful to reproduce this issue with jaxws-jboss-httpserver-httpspi. It turns out it's an issue in jaxws-jboss-httpserver-httpspi-1.0.0.GA and I already fixed it on trunk .
          You are right. It's an oneway ws operation , even without wsdl location and it should return 202.This issue has been resolved in cxf 2.4.5 (please see https://issues.apache.org/jira/browse/CXF-3926) I got the above wrong response because I tried it without providing wsdl location in cxf 2.4.4 and with normal jbossweb servlet transport. In your case, the wsdl location is set in endpoint properties, the oneway informantion can get from wsdl and does not share this problem. Now it returns the response as you expected:
          --------response-----------
          >>>>> received [HTTP/1.1 202 Accepted]
          >>>>> received [Transfer-encoding: chunked]
          >>>>> received [Content-length: 0]
          >>>>> received [Date: Fri, 03 Feb 2012 08:13:39 GMT]
          >>>>> received []
          >>>>> received [0]
          >>>>> received []
          >>>>> end.

          I attach the patched jaxws-jboss-httpserver-httpspi. Please give a try to verify if it resolve the switchyard issue. Thanks.

          Show
          Jim Ma added a comment - These jar version info is great helpful to reproduce this issue with jaxws-jboss-httpserver-httpspi. It turns out it's an issue in jaxws-jboss-httpserver-httpspi-1.0.0.GA and I already fixed it on trunk . You are right. It's an oneway ws operation , even without wsdl location and it should return 202.This issue has been resolved in cxf 2.4.5 (please see https://issues.apache.org/jira/browse/CXF-3926 ) I got the above wrong response because I tried it without providing wsdl location in cxf 2.4.4 and with normal jbossweb servlet transport. In your case, the wsdl location is set in endpoint properties, the oneway informantion can get from wsdl and does not share this problem. Now it returns the response as you expected: -------- response ----------- >>>>> received [HTTP/1.1 202 Accepted] >>>>> received [Transfer-encoding: chunked] >>>>> received [Content-length: 0] >>>>> received [Date: Fri, 03 Feb 2012 08:13:39 GMT] >>>>> received [] >>>>> received [0] >>>>> received [] >>>>> end. I attach the patched jaxws-jboss-httpserver-httpspi. Please give a try to verify if it resolve the switchyard issue. Thanks.
          Hide
          Tomohisa igarashi added a comment -

          Awesome, worked correctly with your patch! Thank you Jim.

          Show
          Tomohisa igarashi added a comment - Awesome, worked correctly with your patch! Thank you Jim.
          Hide
          Alessio Soldano added a comment -

          I've moved the jbossws-cxf stack to using 1.0.1-SNAPSHOT version of jaxws-jboss-httpserver-spi, including the fix. We'll release it when also releasing next jbossws-cxf stack.

          Show
          Alessio Soldano added a comment - I've moved the jbossws-cxf stack to using 1.0.1-SNAPSHOT version of jaxws-jboss-httpserver-spi, including the fix. We'll release it when also releasing next jbossws-cxf stack.

            People

            • Assignee:
              Jim Ma
              Reporter:
              Magesh Bojan
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development