I am invoking a external HTTP URL via Spring Integration, but my URL is completely hard-coded in the spring context file.
I want to:
- pass the Query Params from my program (i.e a=1&b=2&c=3)
- pass the URL itself from my progam (i.e http://host/port/xyz)
My Spring Integration Context file currently looks like this:
<int:gateway id="requestGateway"
service-interface="com.bingo.RequestGateway"
default-request-channel="requestChannel"/>
<int:channel id="requestChannel"/>
<int-http:outbound-gateway request-channel="requestChannel"
url="http//host:port/xyz?a=1&b=2&c=3"
http-method="GET"
expected-response-type="java.lang.String"/>
The java code invoking this is:
public static void main(String args[])
{
ApplicationContext context = new ClassPathXmlApplicationContext(
"spring-integr.xml");
RequestGateway requestGateway = context.getBean("requestGateway",
RequestGateway.class);
String reply = requestGateway.sendMyRequest("");
System.out.println("Replied with: " + reply);
}
Also:
public interface RequestGateway {
public String sendMyRequest(String request);
}
How can i pass the URL(http://host:port/xyz), and especially the params(a=1&b=2&c=3) via my program?