Announcement Announcement Module
Collapse
No announcement yet.
http:inbound-gateway not returning response Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • http:inbound-gateway not returning response

    Hi,

    I am using an http:inbound-gateway for processing a request on server and sending the response back to the client.
    The problem is that it always returns null.
    Here is my configuration:
    Code:
    <int-http:inbound-gateway id="testAdapter.htm" request-channel="testChannel" name="/testAdapter.htm" reply-channel="testGatewayChannel" supported-methods="GET" view-name="defaultJsonView"/>
    	<int:service-activator ref="testConverter" input-channel="testChannel" output-channel="testGatewayChannel" />
    
    	<bean id="testConverter" class="com.messaging.MessageReceiver" />
    	
    	<bean id="testSender" class="com.messaging.ReplySender"/>
    	
    	<int:service-activator ref="testSender" input-channel="testGatewayChannel" method="sendMessage" />
    I even tried using chain:
    Code:
    <int:chain input-channel="testChannel" output-channel="testGatewayChannel">
    		<int:service-activator ref="testConverter" />
    		<int:service-activator ref="testSender" method="sendMessage" />
    </int:chain>
    But still got the same response as null.

    And here is my Sender Class which sends the response
    Code:
    public class ReplySender
    {
    public String sendMessage(Message<?> message)
    	{
    
    		try
    		{
    			System.out.println("in ReplySender sendMessage " + message.getPayload());
    
    			
    		}
    		catch (Exception e)
    		{
    			e.printStackTrace();
    		}
    		return   message.getPayload().toString();
    }
    }
    I am getting response as null on my client side.
    Where am i going wrong?Am i using the right method?
    Which is the best method for returning a response to the client?
    Please help.
    Thanks in advance..
    Last edited by annuk; Nov 1st, 2011, 06:51 AM.

  • #2
    Hi,

    It worked.
    Used the below configuration for the inboundgateway..
    Code:
    <bean id="deviceAdapter.htm" name="/adapter.htm"
    		class="org.springframework.integration.http.inbound.HttpRequestHandlingMessagingGateway">
    		<constructor-arg value="true" /> <!-- indicates that a reply is expected -->
    		<property name="requestChannel" ref="requestChannel" />
    		<property name="replyChannel" ref="responseChannel" />
    		<property name="supportedMethodNames">
    			<list>
    				<value>GET</value>
    				<value>POST</value>
    			</list>
    		</property>
    	</bean>
    Thanks..

    Comment

    Working...
    X