-
1. Re: HTTP GET with parameters
kcbabo Jul 8, 2013 8:05 AM (in response to synclpz)1 of 1 people found this helpfulFor fine-grained control over the HTTP interaction, going with the Camel HTTP component is a reasonable approach. It would not be particularly difficult to add this capability to our HTTP gateway in the box, so feel free to log a JIRA requesting that feature if you like.
Setting the headers for the Camel HTTP component can be done via message context properties in SY. Unfortunately, for 1.0 you are going to hit this limitation with a Bean service performing the invocation:
https://issues.jboss.org/browse/SWITCHYARD-1465
That will be fixed for 1.1. In the meantime, you could use a Camel routing service and just use <setHeader> in the route.
-
2. Re: HTTP GET with parameters
synclpz Jul 8, 2013 10:28 AM (in response to kcbabo)Ok, I've also found this method - setting header via camel service. That's good I'm on the right way.
I'll try to setup the following scenario:
<SCA binding> --> <Camel Impl> --> <Camel http4-reference>
1. SCA binding receives some, for example, HttpRequestBean with URL, params, HTTP-headers, cookies etc.
2. Camel service implementation invokes several setHeader(), according to bean's fields
3. http4-reference sends HttpRequest, receives HttpResponse, but what happens then?
How can response be parsed and converted to some HttpResponseBean to return through SCA binding?
-
3. Re: HTTP GET with parameters
synclpz Jul 11, 2013 10:06 AM (in response to synclpz)Got this working, sending HTTP-GET requests, but can't find the way to deal with response from server. Seems like camel-route component can only process in-only message flow. Is there a way to make response available?
-
4. Re: HTTP GET with parameters
kcbabo Jul 11, 2013 10:32 AM (in response to synclpz)Post the route please.
-
5. Re: HTTP GET with parameters
synclpz Jul 15, 2013 12:50 PM (in response to kcbabo)Sorry, removed this project already. It was something like this:
from("switchyard://HttpService").removeHeaders(".*").setHeader(Exchange.HTTP_URI, simple("$body.uri")).to("switchyard://HttpServiceRef");
where HttpService is something like
interface HttpService {
HttpResponseBean performGet(HttpRequestBean data);
}
HttpServiceRef is also this interface, but with camel-http4 binding.
At the moment I try to extend http-component of SY to parse headers and use provided "url" instead of baseUrl, specified in OutboundHandler and then put needed header to Exchange context via custom MessageComposer and ContextMapper