Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Api Management and routes

Hi all, 
I have a route that's calling a Rest Web service. (see in my little drawing Smiley Tongue)
I have 2 questions please: 
1: what it's wrong with the el exptression I'm using, I retrieve a json data; whan I use a "rout" link between the cMessageRouter and the cProcessor, everything works just fine, but when I try to filter the output, it doesn't work, I also tried the type "simple".
2: how can I  "call the route from an API Manager" (the green part in the drawing )if I can say it this way? is there a component that has to be added to the route? 
If I consume the Rest web service directly, I juste have to use the URL, put it in the API Manager. Now that I'm using the bus, I'm a little confused. 
Thank you for your time
-Regards  
Labels (4)
20 Replies
Anonymous
Not applicable
Author

I thought about using the cJMS component, but I didn't find any tutorials showing how to send a message from a route to an another application. this link isn't very helpful in my case  Smiley Sad
Anonymous
Not applicable
Author

You appear to be using the Simple language incorrectly. I am assuming that "id" is a header. Check out the use of the Simple language here. Also, have you set this header anywhere?
About your second question, you wouldn't normally "call a route". A route is just there ready to act on your data. However you can use a cCXF component and a WSDL to enable you to send messages to the route via a SOAP service call. This is reasonably tricky if you are not familiar with the toolset and a little difficult to remotely talk someone through. However, there are tutorials around for this I am sure. Talend actually provide a guide to this component here.
You could use the cJMS component and consume messages from an ActiveMQ. Talend provide instructions on this here.
Anonymous
Not applicable
Author

Actyually "id" isn't a header, it's a part of the json object
Anonymous
Not applicable
Author

I know that I don't normally call a route, it's just that I didn't know how to express what I want to do.
Normally, so as to consume my service web, I use the URL "localhost:8080/appli..." now I want to introduce the bus between the web service and the api manager, so I can no longer use the URL, I have to  "call the route"/"send a message from the route" (I'm sorry I don't know which is correct) from/to the API manager 
PS: I'm not sure if I can use your solution since I have a REST service, not a SOAP
Anonymous
Not applicable
Author

OK. Maybe look at Camel JSONPath to identify the "id". What you are doing in the route at the moment looks like you are trying to retrieve a header using the Simple language. I can't give you the answer here as I would need to try it out to work it out myself.
With regard to calling the API Manager, I misunderstood. I thought you were talking about initiating the route replacing the cTimer. You will need to give us more information on the API Manager. What interfaces does it supply? The whole point of an ESB is that it can communicate with different systems in a plethora of different ways, so you will be able to communicate with it. But what are the options?
Anonymous
Not applicable
Author

Well, I'm using the API Manager "APIMAN".
What I'm asked to do, is to  place the bus just in the middle, so that communication between the Rest web service, Apiman and BonitaSoft would be garanteed using routes. 
So I made a route consuming the web service, 
my quetsion, in other terms, would be, how could the route send the json it has received from the web service, to the API manager?? 
because normally,apiman would implement the URL "localhost:..." I've already used in the cHTTP component, but now, Apiman will receive the output of the route.
I hope my question is more clear now. 
please find the  architecture of my project attached.
Anonymous
Not applicable
Author

I don't know APIMAN I am afraid. But briefly Googling it has revealed that is provides a REST API service. In which case I imagine you can use that to communicate with it. You need to use a cHttp configured as a client to do this.
To get the response from the cHttp you have used previously, you may want to use a cProcessor component to interrogate the Exchange object. Take a look at this for examples of working with the Exchange object.
Unfortunately Talend ESB is much easier to work with if you are familiar and comfortable working with Java. As a product of that, it is harder to help in this situation by simply suggesting using particular components. I think you will need to use a bit Java to deal with getting hold of the JSON string .....
String json = exchange.getIn().getBody(String.class);

....or ....
${in.body}

....if you want to use the Simple language in your cHttp component sending the JSON.

I would have to try a few things out before I got it right. That is what I recommend here. The more you try out, the more you will learn. Unless someone has carried out this exact task, I reckon it will take some time with a lot of backwards and forwards exchanges before you get the answer.
Anonymous
Not applicable
Author

I'm afraid I still didn't make myself clear enough. 
Firstly, I've already used the bit of code 
System.out.println("Body received: " +exchange.getIn().getHeader("CamelFileName") +"\nContent:\n " +exchange.getIn().getBody(String.class));

in the cProcessor to print the json body I received from my web service, here's the output: 
,"routingConstraintsLigneses":[],"routeses":[]}]

Now concerning the matter with Apiman. The whole point of using a bus, is to garantee communication between different systems, if I'm not mistaken. 
My systems are: 
  1: a service web
  2: an api manager
normally, I would use the the URL "localhost:..." as an endpoint in apiman to consume the web service, which would be: 
   ==JSON==>
now I want to put talend between those two systems: 
   ==json==>  Talend(route)  ==>  
in my case, apiman should consume the route message instead of getting it from the web service directly. 
the point is, I don't know how could a route "deliver" a message to an other system, wether it's apiman or sth else. 
as show in the screenshot, I should write an "api endpoint", when I exposed the web service directly, I just had to put the URL, but now that I introduced the bus in the middle, I don't know how to "expose the route" ,if I may say,in apiman. 
Anonymous
Not applicable
Author

OK, so you are familiar with the Exchange object. That is good to know. 
The problem we have here is that you are not explaining how you can communicate with APIMAN. I have suggested via a REST service, but that is a guess from quickly Googling APIMAN. APIMAN is not a Talend product. While an ESB is meant to enable communication between devices/systems, you need to know the interfaces that are available. If your interface was a Java API, I would say call it in a cProcessor component. If it is A REST service, I would say call it via a cHttp configured as a client. It could even be a flat file that needs to be placed into a particular location to be consumed by APIMAN. As I do not know what the interface is or the details of that interface, I can't really give any more info than I have already.