Activatorからint-http:outbound-gatewayにオブジェクトまたはjsonを渡す方法。Springインテグレーションでint-http:outbound-gatewayを使用してオブジェクト/ jsonメソッドをポストする方法
以下<int:channel id="preparedData"/>
<int:service-activator input-channel="preparedData" ref="writer" method="writeData" output-channel="CallbackChannel">
</int:service-activator>
<int:channel id="CallbackChannel" />
<int-http:outbound-gateway
request-channel="CallbackChannel"
http-method="POST" url="{url}"
extract-request-payload="true">
<int-http:uri-variable name="url" expression="headers['url']" />
</int-http:outbound-gateway>
私のconfigsであり、私の活性化剤は上記の設定は、エラーの下に取得して@RequestBody
に一方のコントローラでPOST APIで期待されている1つのオブジェクトを返しています。
13:58:41.202 [task-scheduler-1] ERROR org.springframework.integration.handler.LoggingHandler - org.springframework.messaging.MessageHandlingException: HTTP request execution failed for URI [http://**myUrl**]; nested exception is org.springframework.web.client.HttpClientErrorException: 400 Bad Request
親切に示唆しています。
EDIT1
私はアクティベーターでJSON形式で私の返されたMyObjectに変換していた場合、私は、エラーの下に取得しています。
nested exception is java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
編集2
I「が入力」などのキーと値のペアの1でマップとオブジェクトのために私のアクティベーターの私のreturntypeにを変更した場合、それは以下のように文句を言います。