Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm fairly new to Talend (ESB or otherwise), so feel free to let me know if there is a better way to accomplish what I'm trying to do.
The problem I have to solve is that there is a program that performs HTTP POSTs with an associated JSON body and needs to talk to a service that accepts HTTP POSTs with url query parameters. So I have to read the request from the client, extract the fields I need from the original request's body, and use those fields to generate the url for the destination server. To accomplish this I have used the following design:
Steps 1 through 4 work great. But I'm stuck on step 5. I've searched and I have no idea how to access the properties I set in the previous step. I tried using the form style on the client configuration, but it seems to me it treats whatever I put there as a fixed string.
Any idea on how go about doing this? As I said earlier, if there is a better way to do this, I'm not married to this design at all.
Thanks in advance.
Santi
I figured it out. For future reference, what I did was create a messagingEndpoint component, using the ahc schema (probably any other http type of connector would do the trick). The key is that it doesn't really matter what url you specify on the actual component's configuration dialog. It all can be overridden by editing the headers. So I used a processor node and ended up calling setHeader(). Like so:
exchange.getIn().setHeader(Exchange.HTTP_URI, "http://localhost:8080/"); exchange.getIn().setHeader(Exchange.HTTP_PATH, "my/base/path/goes/here"); exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST"); exchange.getIn().setHeader(Exchange.HTTP_QUERY, "PARAMETER1=" + value1 + "&PARAMETER2=" + value2);
I figured it out. For future reference, what I did was create a messagingEndpoint component, using the ahc schema (probably any other http type of connector would do the trick). The key is that it doesn't really matter what url you specify on the actual component's configuration dialog. It all can be overridden by editing the headers. So I used a processor node and ended up calling setHeader(). Like so:
exchange.getIn().setHeader(Exchange.HTTP_URI, "http://localhost:8080/"); exchange.getIn().setHeader(Exchange.HTTP_PATH, "my/base/path/goes/here"); exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST"); exchange.getIn().setHeader(Exchange.HTTP_QUERY, "PARAMETER1=" + value1 + "&PARAMETER2=" + value2);