-
1. Re: HttpGateway Question...
mageshbk Sep 9, 2011 6:06 AM (in response to david.escandell)Have you declared your action to be a RequestResponse mep? Have a look at the http_gateway quickstart.
-
2. Re: HttpGateway Question...
david.escandell Sep 9, 2011 10:37 AM (in response to mageshbk)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...
jboss-esb.xml:
<?xml version="1.0"?>
<jbossesb parameterReloadSecs="5"
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml/jbossesb-1.2.0.xsd"
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">
<providers>
<!-- 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>
<jms-bus busid="incomingGWChannel">
<jms-message-filter dest-name="queue/incomingGW" dest-type="QUEUE" transacted="true"/>
</jms-bus>
</jms-provider>
<http-provider name="ImageUploadRequestHTTP">
<http-bus busid="imageUploadHTTPRequest"/>
</http-provider>
<!-- added for testing jboss esb solution -->
</providers>
<services>
<service category="Test" description="dooty" invmScope="GLOBAL" name="HttpGatewayTestService">
<listeners>
<http-gateway busidref="imageUploadHTTPRequest"
name="HttpGatewayListener" payloadAs="BYTES" urlPattern="services/upload/*">
<asyncResponse statusCode="200"/>
</http-gateway>
<jms-listener busidref="incomingChannel" maxThreads="5" name="incomingListener"/>
<jms-listener busidref="incomingGWChannel" is-gateway="true"
maxThreads="5" name="incomingGatewayListener"/>
</listeners>
<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>
<action class="com.famc.esb.actions.RequestHandlerAction"
name="RequestHandler" process="process"/>
</actions>
</service>
</services>
</jbossesb>
RequestHandlerAction.java:
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");
}
@Override
public Message process(Message message) throws ActionProcessingException {
System.out.println("inside RequestHandlerAction.process(Message message)");
return message;
}
}
-
3. Re: HttpGateway Question...
david.escandell Sep 9, 2011 11:52 AM (in response to mageshbk)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...
arnoldjohansson Sep 22, 2011 6:16 AM (in response to david.escandell)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";
message.getBody().add(response);
return message;
-
5. Re: HttpGateway Question...
mageshbk Sep 26, 2011 1:02 AM (in response to david.escandell)Since you want to send a response back remove this property
<asyncResponse statusCode="200"/>
-
6. Re: HttpGateway Question...
kotaris Oct 12, 2011 4:13 PM (in response to david.escandell)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...
arnoldjohansson Oct 12, 2011 6:18 PM (in response to kotaris)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.