4 Replies Latest reply on Apr 30, 2010 2:56 AM by walter.accantelli

    (fuse 4.2) how to call an external web service with camel?

    walter.accantelli

      Hi all,

      I'm trying to develop an EIP with Apache Camel in order to have the following scenario:

      1) Expose a simple web service (SampleService) and read an incoming parameter (SampleIn string)

      2) Call an external service (for this sample, I've used a public weather service http://ws.cdyne.com/WeatherWS/Weather.asmx?wsdl) and get the response from external weather service (i.e. weather city)

      3) Compose and return a sample response (SampleOut string)

       

      I package the sample and deployed successfully into my Fuse 4.2 installation:

          osgi:list |grep Sample

          Web Service Sample 1 (0.1)

       

      Calling the web service at http://localhost:9105/CamelContext/MySample I get the following error:

      Error processing Exchange. Exchange[Message: org.example.sample.SampleRequest@138fec2]. Caused by:

       

      --

       

      This is what I've done (I've attached the eclipse code):

      1) Create sample.wsdl and generate the endpoint

      2) Create a camel route the read incoming request and return a response

      3) Create the client classes (using cxf-codegen-plugin with -client option) to call the external web service

      4) Add the web service client calling code to camel route bean

       

      That error occours when I instantiate the objects I need to call the external web service:

       

          Weather weatherService = new Weather();    // here I got the error

          WeatherSoap weatherSoap = weatherService.getWeatherSoap();

          WeatherReturn weatherReturn = weatherSoap.getCityWeatherByZIP("zip");

          String weatherCity = weatherReturn.getCity();

       

       

      I read in the Fuse forum that other developers have the same issue with Fuse 4.2, that has been resolved as described here: http://fusesource.com/forums/thread.jspa?threadID=1692&tstart=0

      But it doesn't work to me.

       

      Does anyone have suggestions?

      Does anyone have a working sample to call an external web service with Fuse 4.2?

       

      Thanks in advance,

      walter

       

      Edited by: walter.accantelli on Apr 30, 2010 6:50 AM