ConverterNotFoundException on sending a string object to rest service in spring integration
我正在尝试通过
从 spring-integration 向 REST 服务发送 JSON 字符串
但得到错误
No converter found capable of converting from type java.lang.String to type org.springframework.http.ResponseEntity< ? >
分享相关细节
1 2 3 4 5 6 7 8 | <int-http:outbound-gateway id="xtifygateway" request-channel="requestchannel" request-factory="requestFactory" url="${xtifyUrl}" http-method="POST"> </int-http:outbound-gateway> <int:header-enricher input-channel="requestchannel"> <int:header name="Content-Type" value="application/json"/> </int:header-enricher> |
发送请求的接口是
1 2 3 4 |
我在java中使用这段代码并调用接口方法。
1 2 3 4 | ObjectMapper objectMapper = new ObjectMapper(); try { String xtifyJson = objectMapper.writeValueAsString(xtifyRequest); } |
有人可以帮忙吗?我在这里错过了什么?
我想你正在寻找这个:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <xsd:attribute name="expected-response-type" type="xsd:string"> <xsd:annotation> <xsd:documentation> The expected type to which the response body should be converted. Default is 'org.springframework.http.ResponseEntity'. This attribute cannot be provided if expected-response-type-expression has a value </xsd:documentation> <xsd:appinfo> <tool:annotation kind="direct"> <tool:expected-type type="java.lang.Class" /> </tool:annotation> </xsd:appinfo> </xsd:annotation> </xsd:attribute> |
一方面