Chapter 4. Migrating a SOAP application to RESTful web services
You can use the WSDL-to-Camel Rest wizard to migrate from an existing JAX-WS SOAP web services implementation to a RESTful web services implementation by using an existing WSDL. The wizard is available as part of Fuse Tooling and it is based on the
wsdl2rest utility, available in Github wsdl2rest project.
It supports the following specifications/configurations:
- Document/literal (doc/lit)
- Document/literal Wrapped (doc/lit wrap)
- RPC/literal (rpclit)
4.1. Wizard workflow
The wizard uses a WSDL path which can be a valid URL (in the
file:// URL form) or a remote URL (using
https) and the selected Fuse project. In the wizard, you provide the paths for the generated Java code, the generated Camel configuration file, the target address for the generated camel endpoint, and the bean implementation class.
The wizard generates the destination Java and Camel paths based on the project. The generated Java code is available in
src/main/java and the Camel file in an appropriate location for Spring or Blueprint, such as
You can modify the generated classes and configure them to a certain point.
Before you begin, you must meet these prerequisites:
- A pre-existing Fuse Integration Project. You can create a new project using the File→ New→ Fuse Integration Project wizard.
A WSDL file accessible through URL. It can be local (
file:// url) or remote (
4.3. Migrating a sample SOAP application to RESTful web services
Follow these steps to run the wizard:
- In CodeReady Studio, select your Fuse project in the Project Explorer view.
Right-click on the Fuse project and then select New → Camel Rest DSL from WSDL.
The Select Incoming WSDL and Project for Generated Output page opens. The Destination Project field is automatically pre-populated with the Fuse project selected in the Project Explorer. This project is the destination for the artifacts that the wizard generates.
- For WSDL File, specify the original SOAP service for processing.
Click Next. The Specify Advanced Options for WSDL-to-REST Processing page appears.
- For Destination Java Folder, specify the location of the CXF-generated Java classes.
For Destination Camel Folder, specify the location of the generated Camel Rest DSL configuration file.Note
The path and name of the generated Camel file varies based on the type of Camel project:
For Spring projects:
For Spring Boot projects:
For Blueprint projects:
- For Spring projects:
- Optionally, for Target Service Address provide the SOAP address specified in the WSDL binding. You can change this option to match the actual address of the SOAP service referenced by the WSDL.
Optionally, for Target REST Service Address provide the URL for accessing the REST service. This URL is decomposed into settings for the
<rest>tags in the Rest DSL to specify the complete URL for REST operations mapped to the SOAP service.
Click Finish to create two files as the output:
- The Camel configuration with Rest DSL.
- Java classes from CXF to wrap the SOAP service.