Camel SOAP – REST Bridge Example


This example of a Camel SOAP – REST bridge exposes part of the Github REST API as a SOAP interface using a code first approach using the Camel CXF component. Github provides an extensive REST API, we’ll just expose three of the many methods it provides. Get project tags, get project branches and get owner repos.

Define the contract

I used the Camel CXF component to expose a code first SOAP example.

Configure CXF Component

Next configure the CXF component. Set the address the service will be exposed on, the service name, the namespace and the service class (which is the class we defined above).

Define the Routes

The entry point just routes each operation to it’s own Direct endpoint.

Currently the results are sent back inside a CDATA block as a JSON string. Pretty simple to marshal the JSON to XML but I went for simple for this example.

Try it out

The full code is available on GitHub at

Compile the example using  mvn install  then run it using  mvn camel:run

The WSDL will be available at http://localhost:9090/github?wsdl

Try it out using SoapUI or another Soap tool. In soapUI create a new project and point to the WSDL above. You should see the three operations we defined in our service class.



To test just expand one of the operations and double click on the request. Here’s the request for getProjectBranches with the parameters filled in for Camel.







Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

Comments on this entry are closed.

  • Adeel Ahmed

    can you please share the code to build Rest-Soap example ? its been 7 days and i am trying to work on it