Instead of using transformers, you should be able to use the inbuilt converters in the http gateway. In the <gateway/> add a <header/> to set the content-type to application/json and just pass your request payload to the http gateway; set the expected-response-type to your reply object.
thanks for the quick response. For my real case, the external rest API has more methods with different response objects - because of that, it's not so nice to put the expected-response-type to one response object.
BTW, the <int-http:outbound-gateway> supports this one:
SpEL expression to determine the type for the expected response to which the response body should be converted
The returned value of the expression could be an instance of java.lang.Class or
java.lang.String representing a fully qualified class name.
This attribute cannot be provided if expected-response-type has a value
Where the real Class for MappingJackson2HttpMessageConverter can be determined against requestMessage.
So, you always can place a desired response type to the headers and extract it at runtime for each request.
Marcel, we are glad to hear that we helped, but be sure for the future do not abuse JIRA with such a support question.
The StackOverflow is the best place for such a work. We will ask you for JIRA ticket from there if we really find that it is necessary
Marcel Alburg opened INT-3647 and commented
i use Spring Integration Http with an outbound Gateway and try to connect to an other REST Service.
For the Request and the Response, i use different POJO's.
For my gateway, i use an Interface like that.
and my Integration Config looks like
and my model is calling this service.
The problem is, that the object-to-json-transformer add the header "json__TypeId__=class Request" and the json-to-object-transformer try's to create the wrong object with the error
For this case, it's easy to change the transformer to:
and it's works, but i've a lot of calls with different ResponseObjects.
It is possible to make the Transformer more flexible or how can i hook me in the ConversionService for making an fallback converter.
Because in the transform, i don't get the correct return type from the gateway. The ConversionService has it in the convert method.
Thanks for you help
No further details from INT-3647
The text was updated successfully, but these errors were encountered: