Spring integration Spring集成http出站网关POST restful调用和JSON

Spring integration Spring集成http出站网关POST restful调用和JSON,spring-integration,Spring Integration,我试图从Spring与http:outbound gateway的集成中进行一个后restful api调用。但是我不知道如何将请求JSON对象传递给restful API。有人能告诉我怎么做吗?谢谢 这是我的spring-integration-config.xml <si:channel id="request.channel" /> <si:channel id="response.channel"> <si:queue capacity="10"

我试图从Spring与http:outbound gateway的集成中进行一个后restful api调用。但是我不知道如何将请求JSON对象传递给restful API。有人能告诉我怎么做吗?谢谢

这是我的spring-integration-config.xml

<si:channel id="request.channel" />

<si:channel id="response.channel">
    <si:queue capacity="10" />
</si:channel>

<int-http:outbound-gateway id="employeeinfoGateway"
    request-channel="request.channel" 
    url="http://localhost:8080/EmployeeInfo"
    http-method="POST" 
    expected-response-type="java.lang.String" 
    charset="UTF-8"
    reply-timeout="5000" 
    reply-channel="response.channel">
</int-http:outbound-gateway>
以下是我收到的错误消息:

Could not write request: no suitable HttpMessageConverter found for request type [org.json.JSONObject] and content type [application/json], failedMessage=GenericMessage [payload={"empId":"100"}, headers={content-type=application/json, id=a0aba65f-3f49-4dfc-2431-51983666772b, timestamp=1521419315405}]

不确定那是什么
JSONObject
。在我看来,Jackson JSON处理器不是这样工作的,但我建议尝试只发送一个普通的
java.util.Map

下面的
restemplate
中有一个
MappingJackson2HttpMessageConverter
,用于将传入的有效负载转换为JSON表示


也许您的类路径中没有
com.fasterxml.jackson.core:jackson-databind
jar?

我试图将java.util.Map传递到消息负载中,但没有成功。OK!在类路径上有Jackson jar让
RestTemplate
为JSON做艰苦的工作吗?是的,它可以工作。谢谢你,阿泰姆。我添加了jackson databind jar,然后将java.util.Map传递给消息负载。
Could not write request: no suitable HttpMessageConverter found for request type [org.json.JSONObject] and content type [application/json], failedMessage=GenericMessage [payload={"empId":"100"}, headers={content-type=application/json, id=a0aba65f-3f49-4dfc-2431-51983666772b, timestamp=1521419315405}]