I am using Spring Integration to facilitate a simple REST GET over HTTP. Essentially, a client makes a GET request to SI with a single query parameter via an inbound gateway, and SI needs to make its own outbound GET request to an existing service passing the same parameter.
Here is the my configuration:
Things look good early on as you see here:Code:<http:inbound-gateway id="documentByIdInboundGateway" request-channel="documentByIdRequestChannel" reply-channel="documentByIdReplyChannel" name="/documents/{id}" supported-methods="GET"/> <http:outbound-gateway id="documentByIdTargetAdapter" url="http://localhost:8080/myapp/documents/{id}" http-method="GET" request-channel="documentByIdRequestChannel" reply-channel="targetDocumentByIdReplyChannel" expected-response-type="com.myapp.Document" charset="UTF-8" header-mapper="jsonHeaderMapper"> </http:outbound-gateway>
But then I get the following exception:Code:18:56:16,609 DEBUG [BeanNameUrlHandlerMapping.lookupHandler] Matching patterns for request [/documents/1232332] are [/documents/{id}] 18:56:16,609 DEBUG [BeanNameUrlHandlerMapping.lookupHandler] URI Template variables for request [/documents/1232332] are {id=1232332}
I have tried to do some things with <http:uri-variable>, but that hasn't worked for me either.Code:org.springframework.integration.MessageHandlingException: HTTP request execution failed for URI [http://localhost:8080/myapp/documents/{id}] at org.springframework.integration.http.outbound.HttpRequestExecutingMessageHandler.handleRequestMessage(HttpRequestExecutingMessageHandler.java:243) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:98) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:78) at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:110) . . . .
I would love to know how to extract the id parameter from the inbound request and tack it on to the outbound request. Any insight is appreciated.
Thanks.


Reply With Quote