camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yee Keat Phuah <ykph...@gmail.com>
Subject Possible to use Camel as a translator/proxy for web service?
Date Fri, 21 Jul 2017 02:33:38 GMT
I have a client that will be calling a webservice, based on certain
signature, e.g. /ticketDescriptionGet?ID123, and expect to get back the
description of the tickets. I want to use Camel to hook it up to a server
serving a Web Service that uses a different URL and also a different Reply
format.

With the following set up, I can get back the whole reply from the server:
    from("netty4-http:http://localhost:8080/ticketDescriptionGet")
                        .choice()
                        .when(header(HEADER).startsWith(PREFIX_INCIDENT))
                        .to(("http4:" + URL_INCIDENT + header(HEADER)
                                + "&bridgeEndpoint=true&view=expand"));

The server's reply is in a json format, that I want to extract just a piece
of information from it.

So I tried something like this:
              from("netty4-http:http://localhost:8080/ticketDescriptionGet")
                        .choice()
                        .when(header(HEADER).startsWith(PREFIX_INCIDENT))
                        .to(("http4:" + URL_INCIDENT + header(HEADER)
                                + "&bridgeEndpoint=true&view=expand"))
                        .transform().jsonpath(JSONPATH_INCIDENT);

But it doesn't work. I understand that if I put the transform before the
"to", then the transform will work on the Request message instead of the
Reply.

I have read the Request-Reply pattern in the camel website but still
couldn't figure out how to do this. Is this possible at all?

Thanks in advance!
-- 
Cheers,
Phuah Yee Keat

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message