Configuring the outbound HTTP messages
Spring provides HttpRequestExecutingMessageHandler,
which takes a string URL as a constructor argument. The class has a property called ReponseChannel,
which also needs to be configured.
The bean will call the RestTemplate
class by reading the URL configured in the constructor, which the RestTemplate
calls HttpMessageConverters
. The list of HttpMessageConverters
are read and the HttpRequest
body is generated.
The converter and HttpRequestExecutingMessageHandler
are shown in the following code:
<bean id="httpOutbound" class="org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler"> <constructor-arg value="http://localhost:8080/myweb" /> <property name="outputChannel" ref="responseChannel" ...
Get Mastering Spring Application Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.