This feature allows users to expose their legacy SOAP backends as REST APIs through WSO2 API Manager. WSO2 API Manager supports WSDL 1.1 based SOAP backends.
The following instructions explain how to generate REST APIs in WSO2 API Manager for an existing SOAP backend.
Before you begin...
Make sure that you have a valid WSDL URL from the SOAP backend. It should belong to the WSDL 1.1 version.
- Sign in to the API Publisher and click ADD NEW API, which is under the API menu.
- Select I Have a SOAP Endpoint. You see the following two options to create APIs for SOAP backend.
- Pass Through – Create a pass through proxy for SOAP requests coming to the API Gateway. You can either select a WSDL URL to provide a URL for your API or you can upload a WSDL archive/file.
- Generate REST APIs – This option is used to generate REST API definitions from the given WSDL URL. Therefore, select a WSDL URL and provide the file URI by giving the relative path to the file with the API definition as follows:
Select Generate REST APIs (The default option is Pass Through). Provide the WSDL URL given below for the SOAP backend and click Start Creating.
The WSDL URL and WSDL Archive/File options that are shown in the following screenshot, which allow you to modify API resources, are only available as a WUM update and is effective from 11th January 2019 (11-01-2019). For more information, see Updating WSO2 API Manager.
Click on Edit Source to edit the Swagger specification of the API.
When generating the API using WSDL URL, POST resources only get generated with the request body and the API does not get generated with the query parameters. If you are using the WUM update and if you need to add query parameters to a POST resource, you need to modify the Swagger definition of the API.
The automatically generated REST resources of the API appears.
You can describe your REST API better by modifying the Open API Specification that you see on this page. The following is a sample of how this particular API has been described.
Optionally, update the Swagger definition of your API and click Apply Changes to save your API.
Let's update the API by replacing the existing Swagger definition with the following Swagger definition.Expand to see the edited Swagger definition...
The generated API definitions are added to the API as shown below.
A REST API method is mapped with the corresponding SOAP operation through a Swagger, vendor-specific field -
x-wso2-soap. Note that this should not be edited. A parameter without this field cannot be mapped with a SOAP backend operation.
See the sample REST operation given below.
operationIdparameter is used to map the REST resource with the corresponding SOAP operation.
Edit the details of the API as shown below.
Field Sample value Name PhoneVerification Context
Version 1.0.0 Access Control All Visibility on Store Public Tags
For more information on the meanings of the latter mentioned fields, see Create and Publish an API.
- Go to the Implement tab. Click on Managed API.
Select the Endpoint Type as the HTTP/SOAP Endpoint. Enter the SOAP endpoint URL given below.
Navigate to the SOAP to REST Mapping section. Click on a resource to view the In and Out sequences of the API.
The following is a sample Synapse based XML configuration which reads some parameters from the request path and constructs the SOAP payload required for the backend (target) services.
The incoming JSON message parameters are stored using properties. The SOAP payload needed for the backend is generated using a payload factory mediator.
- Go to the Manage tab and select the throttling tiers for the API. Click Publish to publish the API to the API Store.
For instructions, see Create and Publish an API.
Navigate to the API Store and subscribe to an API.
After generating the production and sandbox keys you receive a valid access token to access the API.
Run the following HTTP request to invoke the API.
You receive the actual backend response.