Hi Ben,
Thank you for your response. So far, I'm happy with the Processor, even if no so elegant as a SetHeader component, but at least I have the URL of the endpoint separated in the cHTTP, and I can externalise it in the context easily.
EDIT: I realise that your solution (2 setHeader) was the first option I tested, and it never worked. I believe this is an error that has been solved in more recent versions of Talend (or Camel component?). I am using the version 5.1.2 which is starting to be a bit out of date.
I take the opportunity, to ask you about another problem, still related with cHTTP. I want to manage if I have an error in this HTTP call, because I want to send a special reply to the requester of the route.
I put the param "throwExceptionOnFailure=false" found on the Jetty Camel component, but my requester receives this response:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at java.net.Socket.<init>(Unknown Source)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:80)
at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:122)
at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1361)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:387)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
I would like to be able to analyse the response, and if it's connection refused, error 4XX or 5XX, handle it and send special response
Also, I try with a cTry and catch branch, but the route does not compile (see 2nd attached screenshot on my first post of the topic). Here is the code who does not compile
.to(uriMap.get("to Intermediate")).id(
"cMessagingEndpoint_14").when().xpath(
"/OrderStatus/Status='FINAL'")
.to(uriMap.get("to Final")).id(
"cMessagingEndpoint_11").doCatch(
java.lang.Throwable.class).process(
new org.apache.camel.Processor() {
The error displayed is
The method doCatch(Class<Throwable>) is undefined for the type ChoiceDefinition
Any ideas/suggestions? The version of Talend I'm using is 5.1.2.r90681 Professional Edition
Best regards,
Enrique