1
votes

I am using xml based configuration - http outbound gateway to trii=gger a rest service, the response is ResponseEntity and I dont know that service details. The output I receive should be put in a JMS Queue.

How can I update the below to extract only the body of response entity and pass to output-channel? If there is a transformer, please give example. Is it possible using config?

<int:chain input-channel="gsInChannel" output-channel="dest-channel">
<int-http:outbound-gateway          
               url="https://ia-zatie.str13.tst.belst.nu/ia-zaatie/rest/signal/v2"
               http-method="POST"  
               header-mapper="headerMapper"
               request-factory="sslFactory"                
               >
</int-http:outbound-gateway>
    </int:chain>

dest-channel is jms:outbound-channel-adapter

boot version 1.4.3 and integration version 4.3.6

Error: org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.jms.JmsSendingMessageHandler#0]; nested exception is org.springframework.jms.support.converter.MessageConversionException: Cannot convert object of type [org.springframework.http.ResponseEntity] to JMS message. Supported message payloads are: String, byte array, Map, Serializable object.

1
Added expected-response-type="java.lang.String"Kris Swat
Sounds like you have found a solution for your problem. You can answer that way and accept your own answer or close the question at all.Artem Bilan

1 Answers

1
votes

I was using HTTP POST method and so not expecting, a response. SoO has not included expected-response-type, which returns the body

<int-http:outbound-gateway          
               url="https://ia-zatie.str13.tst.belst.nu/ia-zaatie/rest/signal/v2"
               http-method="POST"  
               header-mapper="headerMapper"
               request-factory="sslFactory"  

               expected-response-type="java.lang.String">