Spring Integration 获取 HTTP 出站网关响应
我需要 POST 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 对象。
也许我做错了什么?任何帮助将不胜感激。谢谢!
I need to POST a REST service call and get the data it returns (all of this is with JSON). I have an outbound-gateway with its reply-channel as a chain, and the chain has one transformer.
<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>
However when I debug through the transformer, the payload I get back is just an HttpStatus object.
Maybe I'm doing something wrong? Any help would be greatly appreciated. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您未在网关中指定
expected-response-type
,则默认行为是响应消息仅包含状态代码(expected-response-type 为 null)。尝试设置expected-response-type="java.lang.String"
:If you do not specify
expected-response-type
in your gateway, the default behavior is that the response message contains only status code (expected-response-type is null). Try settingexpected-response-type="java.lang.String"
: