【问题标题】:Spring Integration Get HTTP Outbound Gateway ResponseSpring 集成获取 HTTP 出站网关响应
【发布时间】:2012-03-07 02:40:23
【问题描述】:

我需要发布一个 REST 服务调用并获取它返回的数据(所有这些都使用 JSON)。我有一个出站网关,其回复通道作为一个链,并且该链有一个转换器。

<int-http:outbound-gateway
    url="#{appProperties['rootUrl']}#{appProperties['myMethod']}"
    request-channel="myRequestChannel" reply-channel="myResponseChannel" >
</int-http:outbound-gateway>

<int:channel id="myResponseChannel"/>

<int:chain input-channel="myResponseChannel">
    <int:transformer ref="genericResponseTransformer"/>
</int:chain>

但是,当我通过转换器进行调试时,我返回的有效负载只是一个 HttpStatus 对象。

也许我做错了什么?任何帮助将不胜感激。谢谢!

【问题讨论】:

    标签: gateway spring-integration transformer payload


    【解决方案1】:

    如果您未在网关中指定expected-response-type,则默认行为是响应消息仅包含状态代码(预期响应类型为空)。尝试设置expected-response-type="java.lang.String":

    <int-http:outbound-gateway
      url="#{appProperties['rootUrl']}"
      http-method="#{appProperties['myMethod']}"
      expected-response-type="java.lang.String"
      request-channel="myRequestChannel" reply-channel="myResponseChannel" />
    

    【讨论】:

      猜你喜欢
      • 2014-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多