I would like to get the following kind of routing:
- An HTTP POST message with an XML body is included in CAMEL
- I save some XML body parameters
- The message is routed to an external endpoint.
- External endpoint response (external server)
-> at this point, I would like to check if the response from the external HTTP 200 endpoint is OK, containing an XML parameter equal to SUCCESS. -> if so, then I would like to use some of the saved parameters to create a new HTTP message (method = PUT this time) and send it to an external endpoint
The problem I am having right now is this:
.choice() .when(simple("${in.headers.CamelHttpResponseCode} == 200")) // now I want do a few things, eg: check also the XML body via xpath // and change the message to be sent out (change Method to PUT, ...) .to("http://myserver.com") .otherwise() // if no 200 OK, I want the route to be stopped ... not sure how ? .end()
Question: any idea how to add these additional instructions in case the HTTP response code was 200 OK? It seems like when I cannot add additional statements ... (I got an error in my Eclipse IDE).
Thanks in advance.
Note. Could it be that I have to forward a message if 200 OK matches the βnew endpointβ and then create a new route with this new endpoint? For example:
.choice() .when(simple("${in.headers.CamelHttpResponseCode} == 200")) .to("mynewendpoint") .otherwise() // if no 200 OK, I want the route to be stopped ... not sure how ? .end(); from("mynewendpoint"). .setHeader(etc etc) .to("http://myserver.com")
In this last case, how exactly should I define this "new point"?
opstalj
source share