3 Replies Latest reply on Jan 28, 2011 5:25 AM by Tom Fennelly

    Need help with http-gateway on jboss esb

    nnpaul Newbie

      Hello!

       

      I try to do simple test for send POST request from GWT using RequestBuilder

       

              RequestBuilder rb=new RequestBuilder(RequestBuilder.POST, "http://localhost:8080/Test-Services/http/test/check");

              String xml="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n" +

                      "<request>\n" +

                      "<test>test</test>\n" +

                      "</request>";

       

              rb.setHeader("Content-type", "text/xml");

              try {

       

                  rb.sendRequest(xml,new RequestCallback(){

       

                      public void onResponseReceived(Request request, Response response) {

                      }

       

                      public void onError(Request request, Throwable throwable) {

                      }

                  });

       

              } catch (RequestException e) {

                  e.printStackTrace(); 

              }

       

       

      And jboss-esb.xml is:

       

       

              <service category="Test" name="Service" description="" invmScope="GLOBAL">

                  <listeners>

                      <http-gateway name="test" busidref="testBus" urlPattern="test/*" payloadAs="STRING" />

                  </listeners>

                  <actions mep="RequestResponse">

                      <action name="dispatchAction" class="com.simpletest.esb.TestActions" process="dispatchAction"/>

                  </actions>

              </service>

       

      Request reach service, but when I print request info :

       

      20:17:10,370 INFO  [STDOUT] <org.jboss.soa.esb.http.HttpRequest>

        <contextPath>/Test-Service</contextPath>

        <localAddr>127.0.0.1</localAddr>

        <localName>activate.adobe.com</localName>

        <method>OPTIONS</method>

        <pathInfo>/check</pathInfo>

        <protocol>HTTP/1.1</protocol>

        <remoteAddr>127.0.0.1</remoteAddr>

        <remoteHost>127.0.0.1</remoteHost>

        <contentLength>-1</contentLength>

        <requestURI>/Test-Service/http/test/check</requestURI>

        <scheme>http</scheme>

        <serverName>localhost</serverName>

        <requestPath>/http/test</requestPath>

        <pathInfoTokens>

          <string>check</string>

        </pathInfoTokens>

        <queryParams/>

       

      I see that method is OPTIONS and Content-type is absent and I don't receive any XML data inside message body.

       

      May be someone faced with this or similar problem? What I am doing wrong?

       

      Thanks in advance.

        • 1. Re: Need help with http-gateway on jboss esb
          Scott Dawson Apprentice

          Can you try a simple (no GWT) test with an HTML form in a browser to verify that the ESB side is working? Something like:

          <form method="post" action="http://localhost:8080/Test-Services/http/test/check">

            <input type="text" name="a" value="99" />

            <input type="submit"/>

          </form>

           

          On the GWT side, a quick Google search shows that there may be some problems with RequestBuilder when the URL uses "localhost". Try using the machine name in the URL when creating the RequestBuilder object.

           

          Regards,

          Scott

          • 2. Need help with http-gateway on jboss esb
            nnpaul Newbie

            Yes, this test works fine without GWT .

             

            Using of the machine name or just 127.0.0.1 didn't help.

             

            I've made some more test with RequestBuilder and found that only GET and HEAD method service receives fine, others POST,PUT and DELETE always as OPTIONS.

             

            Also I see the difference in headers only at this part:

             

                <org.jboss.soa.esb.http.HttpHeader>
                  <name>access-control-request-method</name>
                  <value>POST</value>
                </org.jboss.soa.esb.http.HttpHeader>
              </headers>

             

            I don't see that block for GET and HEAD requests.

             

            I've made simple java servlet, and everything worked fine for POST and GET.

             

            I think the problem is on GWT side, becase  when I've made request from java using URLConnection, then I see normal request headers. I will try to ask on GWT forum regarding this problem.

             

            Regards, Paul.

            TRACE

            • 3. Need help with http-gateway on jboss esb
              Tom Fennelly Master

              You could put a sniffer in the middle and see the HTTP trafic going from your GWT app to the gateway... see the headers being passed in etc.