Mapping URI variables as subelement with an HTTP outbound gateway and an outbound channel adapter
In this section, we shall see the use of a URI variable, and URI variable expressions, as a subelement with the HTTP outbound gateway configuration.
If your URL contains URI variables, you can map them using the Uri-variable subelement. This subelement is available for the HTTP outbound gateway and the HTTP outbound channel adapter:
<int-http:outbound-gateway id="trafficGateway" url="http://local.yahooapis.com/trafficData?appid=YdnDemo&zip={zipCode}" request-channel="trafficChannel" http-method="GET" expected-response-type="java.lang.String"> <int-http:uri-variable name="zipCode" expression="payload.getZip()"/> </int-http:outbound-gateway>
The Uri-variable
subelement defines two attributes: name
and expression
. The name
attribute identifies the name of the URI variable, while the expression
attribute is used to set the actual value. Using the expression...