(Spring集成)我可以使用从HTTP-oubound网关收到的消息来响应HTTP入站网关吗?

时间:2015-09-24 13:52:58

标签: spring spring-integration

我有我的ESB,客户端和Web服务。 客户端向ESB发送HTTP请求,响应的ESB必须向Web服务发送HTTP消息:

>     <http:inbound-gateway id="httpInboundGateway"
>           request-channel="receiveChannel" reply-channel="outboundChannel" name="/inboundChannel.html"
>           supported-methods="GET, POST" request-payload-type="java.lang.String" reply-timeout="50000"
> header-mapper=""/>

...

   <http:outbound-gateway url="{destinationAdress}"
            request-channel="outputLevel1Channel" reply-channel="JsonTransformationLevel1Channel" extract-request-payload="true"
            http-method="POST" expected-response-type="java.lang.String" >
            <http:uri-variable name="destinationAdress"
                expression="payload.getDestinationAdress()" />
        </http:outbound-gateway>
        <int:chain input-channel="JsonTransformationLevel1Channel"
            output-channel="outboundChannel">
            <int:json-to-object-transformer type="it.model.ClientRequest">
            </int:json-to-object-transformer>
            <int:transformer ref="clientRequestToRequestTransformer"
                method="transform">
            </int:transformer>
            <int:object-to-json-transformer />
        </int:chain>

当我创建要发送到客户端的消息时,我将其发送到“outboundChannel”,即入站HTTP网关的回复通道。 客户端不会收到任何消息。 这是我的web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">

    <display-name>spring-http</display-name>

    <servlet>
        <servlet-name>webapp</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/servlet-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
        <servlet-name>webapp</servlet-name>
        <url-pattern>/inboundChannel.html/*</url-pattern>
    </servlet-mapping>
</web-app>

感谢。

1 个答案:

答案 0 :(得分:0)

我解决了将Spring集成版本从2.2.4更新到4.2.0版本的问题。感谢。