4 Replies Latest reply on Feb 5, 2011 3:42 AM by madhucm

    RESTproxy?

    izgur

      Hey!

       

      I need a RESTproxy. Can i do that with the ESB?

       

      I managed to make some soapProxy and it works very well. The response time is only about 10ms higher then calling it directly (SoapUI test).

       

      So, Can I proxy some REST services too ?

       

      I read that REST is not supported, but that discussion was 2-3 yyears ago...

       

      Using JBoss5.1, ESB 4.8 and Riftsaw 2.1.

       

      Thanks in advance!

        • 1. Re: RESTproxy?
          scottdawson

          Yes, you can proxy REST services using the http-gateway for incoming requests (see the http_gateway quickstart for examples) and use an HttpRouter action to invoke the proxied service. So the configuration will be something like this:

           

          <listeners>
              <http-gateway name="myrest" />
          </listeners>
          <actions ...
                <action name="httprouter" class="org.jboss.soa.esb.actions.routing.http.HttpRouter">
                   <property name="endpointUrl" value="http://www.example.com/rss/feed.jsp?id=1234"/>
                   <property name="method" value="GET"/>
                   <property name="responseType" value="STRING"/>
                </action>
          ...

           

          Regards,

          Scott

          • 2. Re: RESTproxy?
            izgur

            Thanks for replying!

             

            My REST service that i want to call over my ESB goes like makeCall?callingnumber=034242&callednumber=....

             

            So my proxy REST service(on ESB) must be able to pass the parameters that he got from the call. Can the parameters be passed?

             

            Like the id in your example. It looks like u hardcoded 1234...

             

            BR, Igor!

            • 3. Re: RESTproxy?
              scottdawson

              >> Can the parameters be passed?

              Yes, I think so. You can get the query parameters and other path information from the HttpRequest object -- see http://community.jboss.org/wiki/HTTPGateway

               

              Then use the technique shown in the second post here: http://community.jboss.org/message/575651#575651 -- dynamically create the HttpRouter so that you can set the endpointUrl at runtime.

               

              Regards,

              Scott

              • 4. RESTproxy?
                madhucm

                Thanks scott