Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Need to create a proxy HTTP service on Talend ESB

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:

  1. a cRest component acting as a server
  2. a java Bean modeling the JSON body (the cRest component is configured with that bean as its bean class)
  3. a cProcessor that extracts the fields from the bean and stores them using exchange.setProperty()
  4. a router put in place to filter out some cases (I stop processing on certain values from the original call)
  5. a cHttp component that will make the POST to the destination URL after setting the parameters using the properties set on step 3.

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

Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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);

 

View solution in original post

1 Reply
Anonymous
Not applicable
Author

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);