7 Replies Latest reply on Oct 12, 2011 6:18 PM by Arnold Johansson

    HttpGateway Question...

    David Escandell Newbie

      I have used the HttpGateway to get a request into the system.  This has worked fine.  Now I am wanting to return a response to the caller (calling browser, maybe)  How do I go about doing this? I have found several comments in the quickstarts and the documentation, however I think I have just been dancing around the magical incantation.  Any ideas?



        • 1. Re: HttpGateway Question...
          Magesh Bojan Master

          Have you declared your action to be a RequestResponse mep? Have a look at the http_gateway quickstart.

          • 2. Re: HttpGateway Question...
            David Escandell Newbie

            yes - I followed the quickstart.  Can you please tell me the right way to get content to go out of the gateway to the browser?

            Here are the relevant files as I have implemented them...



            <?xml version="1.0"?>

            <jbossesb parameterReloadSecs="5"


            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd">


              <!-- These queues are the local message aware queues defined for the ESB  -->

              <jms-provider connection-factory="ConnectionFactory" name="JBossMessaging">

               <property name="max-sessions-per-connection" value="5"/>

               <property name="max-xa-sessions-per-connection" value="5"/>

               <!-- Start of LOS/Extranet ESB Queues -->

               <jms-bus busid="incomingChannel">

                <jms-message-filter dest-name="queue/incoming" dest-type="QUEUE" transacted="true"/>


               <jms-bus busid="incomingGWChannel">

                <jms-message-filter dest-name="queue/incomingGW" dest-type="QUEUE" transacted="true"/>



              <http-provider name="ImageUploadRequestHTTP">

               <http-bus busid="imageUploadHTTPRequest"/>


              <!--  added for testing jboss esb solution -->



              <service category="Test" description="dooty" invmScope="GLOBAL" name="HttpGatewayTestService">


                <http-gateway busidref="imageUploadHTTPRequest"

                 name="HttpGatewayListener" payloadAs="BYTES" urlPattern="services/upload/*">

                 <asyncResponse statusCode="200"/>


                <jms-listener busidref="incomingChannel" maxThreads="5" name="incomingListener"/>

                <jms-listener busidref="incomingGWChannel" is-gateway="true"

                 maxThreads="5" name="incomingGatewayListener"/>


               <actions mep="RequestResponse" requestLocation="request" responseLocation="response">

                <action class="org.jboss.soa.esb.actions.SystemPrintln" name="Got It">

                 <property name="message" value="Got It"/>


                <action class="com.famc.esb.actions.RequestHandlerAction"

                 name="RequestHandler" process="process"/>







            package com.famc.esb.actions;



            import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;

            import org.jboss.soa.esb.actions.ActionProcessingException;

            import org.jboss.soa.esb.helpers.ConfigTree;

            import org.jboss.soa.esb.message.Message;



            public class RequestHandlerAction  extends

            AbstractActionPipelineProcessor {



                      public RequestHandlerAction(ConfigTree config){

                                System.out.println("Initializing RequestHandlerAction");




                      public Message process(Message message) throws ActionProcessingException {

                                System.out.println("inside RequestHandlerAction.process(Message message)");




                                return message;





            • 3. Re: HttpGateway Question...
              David Escandell Newbie

              Maybe the HttpGateway is the wrong way to implement a REST based webservice type of thing.  Even thoung I am not usign SOAP, would the WebServiceProducer be a better way to go?

              • 4. Re: HttpGateway Question...
                Arnold Johansson Apprentice

                In your AP, you just need to put the "stuff" (e g html-content) that you want your browser to display, in the body of the message object.


                Like so:


                String response = "some response in e g html";


                return message;

                • 5. Re: HttpGateway Question...
                  Magesh Bojan Master

                  Since you want to send a response back remove this property

                  <asyncResponse statusCode="200"/>
                  • 6. Re: HttpGateway Question...
                    kotaris Newbie

                    Did this work for you? I am also trying to implement the same way with both jms provider and http provider and need to pass an object in the http request and get an object back from the response.


                    Can the same action handle both for jms message and http message? If so can you share the code of how you implemented?

                    • 7. Re: HttpGateway Question...
                      Arnold Johansson Apprentice

                      If the input (your object - which will become the payload of an ESB Aware Message) to the action is the same regardless of provider, then the action can handle it directly. The config in the jboss-esb.xml from David looks about right. There should be one jms listener, and one http listener in the same service. Both will then pass an ESB Aware Message on to the first action in the service.