Search code examples
web-servicesapache-camelfuseesbjbossfuse

Call multi externals Web Service in Apache Camel correct way


I am stuck with Apache Camel. I need to expose an web service through JBOSS FUSE, but the payload that I must return depends on call to two external web services.

So, the first external web service has this URL:

http://someip/externalWSOne

This receive one param named A, and return three values X, Y and Z.

The second one, receive three params named B, X and Y. Notice that X and Y are the returned values from first external web service.

http://someip/externalWSTwo

This second external web service return N1...Nn values that are the final payload

The final user consume only one web service, that is the internal we service that I will expose through JBOSS FUSE. For this reason I need to expose a web service that receive two params

What is the correct way to model this flow in Apache camel? I write the following configuration but the final payload are empty:

<cxf:cxfEndpoint id="epInterno" address="/ep-interno/" serviceClass="somePackage.MyWebServiceInterface">
<cxf:cxfEndpoint id="epExterno1" address="http://someip/externalWSOne" serviceClass="somePackage.ExternalWSOneServiceInterface">
<cxf:cxfEndpoint id="epExterno2" address="http://someip/externalWSTwo" serviceClass="somePackage.ExternalWSTwoServiceInterface">

<camelContext id="blueprintContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
    <route id="ruta1">
      <from uri="cxf:bean:epInterno"/>
      <process ref="proccesorOne" />
      <to uri="cxf:bean:epExterno1" />
      <process ref="processorTwo" />
      <to uri="cxf:bean:epExterno2" />
    </route>
</camelContext>

All artifacts for external web services are generate with Maven plugin.


Solution

  • Ok, I tried probe my solution so I decided to write the three projects mentioned above.

    THE RESULT: YES this is the correct way *

    Seems that for my case, when I use the real WS, I have problems not strict related with apache camel flow, instead of this are related with the implementation of this external WS

    So, if I somebody need to test by self, can try it analyzing the following code for projects in github.

    Thanks