Proxy Web Services request with JBoss Fuse

In this tutorial we will learn how to provide a Web service facade using a Came blueprint project which proxies request to a legacy web service.

This is the second tutorial about Camel and Web services - here you can read the first part: Proxy Web Services request with Camel  where we have covered this scenario:

The scenario we will discuss in this tutorial is the same, just we will turn the project in a blueprint project and deploy it on JBoss Fuse 6.Here is the blueprint for our project:

<?xml version="1.0" encoding="UTF-8"?>

  <cxf:bus><!-- interceptor per request/response del ws/rest -->
      <cxf:logging limit="1024"/>
  <bean id="beanAdapter" class=""/>

  <camelcxf:cxfEndpoint id="input-cxf" address="http://localhost:9080/example-input-cxf/"

  <camelcxf:cxfEndpoint id="SimpleWebSevice"
                    serviceClass="" />
  <camelContext id="example-cxf" xmlns="">
    <route id="input-cxf">
      <from uri="cxf:bean:input-cxf"/>
      <log message="Message input: ${in.body}"/>
                <method bean="beanAdapter" method="transform"  />
      <removeHeaders pattern="*"/>
        <to uri="cxf:bean:SimpleWebSevice" />


So, the first Web service (input-cxf) is just a Contract exposed through the Camel route. It just contains an interface definition or a WSDL. In our case, it is composed of a Web interface:


import com.sample.source.bean.Wrapper;
import javax.jws.WebMethod;
import javax.jws.WebService;

public interface FuseExampleCXF {

  int count(Wrapper wrapper);

This Web service has the count method which receives as input a Wrapper Object. The use case is providing a compatibility facade to Web service clients that use this interface and adapt the parameter using a Bean Transformation. The class which is in charge to perform the transformation is the class which follows here:


import com.sample.source.bean.Wrapper;
import org.apache.camel.Exchange;

public class BeanAdapter {

  public Struct transform(Wrapper input) {
      Struct struct = new Struct();
      return struct;

This class will be in charge to transform the Wrapper class from the incoming Web service into the Struct class which is expected by the target Web service:


import javax.jws.*;

public interface LegacyWebService {
    public int callStruct(@WebParam( name = "total")Struct s);

The Web service is deployed on an external middleware, such as JBoss EAP with the following implementation:


import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

public class LegacyWebServiceImpl implements LegacyWebService {
    public int callStruct(@WebParam( name = "struct")Struct s) {
        System.out.println("Invoked Web service with "+s.getX() + " and "+s.getY());      
        return s.getX() + s.getY();


In order to build the OSGI bundle you can use the following pom.xml :

<project xmlns="" xmlns:xsi=""

    <name>Fuse :: Demo</name>







            <name>FuseSource Community Release Repository</name>

Now from the Karaf command line, install at first the features required to provision the bundle:

JBossFuse:karaf@root> features:install cxf
JBossFuse:karaf@root> features:install camel-jaxb
JBossFuse:karaf@root> features:install camel-blueprint
JBossFuse:karaf@root> features:install camel-cxf

Next, install the bundle on JBoss Fuse with:

JBossFuse:karaf@root> osgi:install -s mvn:org.apache.camel/fuse-demo/0.0.3-SNAPSHOT

That's all. Verify with any Web service client that the Web service available on http://localhost:9080/example-input-cxf/ correctly responds and the route camel forwards the call to the target Web service.

<soapenv:Envelope xmlns:soapenv="" xmlns:ws="">

You should expect as return a response with the sum of the two parameters of the Wrapper object:

<soap:Envelope xmlns:soap="">
      <ns2:countResponse xmlns:ns2="">
FREE WildFly Application Server - JBoss - Quarkus - Drools Tutorials
Cookie Policy

Cookie Policy This website uses cookies that are necessary to its functioning and required to achieve the purposes illustrated in the privacy policy. By accepting this OR scrolling this page OR continuing to browse, you agree to our privacy policy.

© 2020 Your Company. All Rights Reserved. Designed By JoomShaper

Please publish modules in offcanvas position.