1
votes

I am working on a small camel application that needs to read data from a third party SOAP Web Service.

I wanted a camel route similar to this:

public class MyCamelRouter extends RouteBuilder {

@Override
public void configure() throws Exception {
    from("???:mySoapOrRestWebService")
        .to("jms:queue:someQueue"));
}

At first i thought that this could be done with camel-cxf, but its documentation does not mention it.

The only solution that i've found so far is to implement a polling consumer and use it with a timer on the "from" of my route definition.

Is this solution the correct one? Or can this be achieved with some other camel component?

I also need to define a similar route but using a REST web service in the "from"

1
A bit of clarification. There is already a service and you need to get the data from that service . Am i right?Naveen Raj
Yes Naveen Raj, you are right. I need to recive the information from an existing service.lmenaolivares
How will this route be called/initiated? In other words what client is going to use this route? When you add the web service component(CXF) in the from part of the route you are creating a web service producer not consumer so if you start off with the following route from(cxf) you are creating a new web service that has a camel route as the back end. YOu cannot go from(some existing service). If you can tell me how the service will be called i can give you some more information on how to achieve this.Namphibian
Thanks lmenaolivares. Namphibian has shown the right direction but I would like to give my own version as it will help you as a first time user of camel. If you need to get some information from an existing service then you are probably writing a client for the service. In such case you need write a producer , say a <to uri = "calling existing service "> endpoint. So please let us know on what basis, like a scheduled run or once in a day , the existing service is to be called. Thus we can help youNaveen Raj
Thanks to both of you. What i need is to call a existing web service every 20 or 30 seconds. Now i know that i cannot call it on the "from", but what i can do is from(someTimer).to(existingWsUsingCxf).to(myProcessor). Am i correct?lmenaolivares

1 Answers

0
votes

The only solution that i found for this is to use a timer in the from and call the SOAP web service afterwards.

The code i used looks like this:

public class MyCamelRouter extends RouteBuilder {

@Override
public void configure() throws Exception {
    from("timer:soapRequestTimer?{options}")
        .to("cxf:serviceUrl"));
        .to("jms:queue:someQueue"));
}