Tutorial: Creating a REST API definition that invokes an existing SOAP service

This tutorial shows you how to expose an existing SOAP service and transform the XML data that is returned by it into specified JSON data.

About this tutorial

Follow this tutorial to create a REST API in API Manager by importing the WSDL for an existing SOAP service. Both SOAP 1.1 and SOAP 1.2 standards are supported by API Connect. When invoked, the API returns the balance of a fictional bank account for a particular user.

In this tutorial you will complete the following lessons:
  1. Setting up a REST API definition
  2. Testing your API definition

Before you begin

Note: The Sandbox catalog must be configured to use either a DataPower® API Gateway, or a DataPower Gateway (v5 compatible), or both. See Creating and configuring Catalogs.

Setting up a REST API definition

To set up a REST API that invokes an existing SOAP service, complete the following steps.

  1. Download the SOAP WSDL file AccountServicing.txt. Rename this file AccountServicing.wsdl.
  2. Log in to the API Manager UI.
  3. Click the Develop APIs and Products tile.

    API Manager screen

  4. Click Add > API (from REST, GraphQL or SOAP).

    API add menu

  5. Ensure that OpenAPI 2.0 is selected.
  6. Select From existing WSDL service (REST proxy). Click Next.

    Create REST proxy

  7. In the File Upload section, either drag and drop the AccountServicing.wsdl file, or click to upload from your filesystem.

    WSDL confirmation screen

  8. The file uploads, and is parsed by API Connect. A confirmation message is displayed. Click Next to continue.
  9. Select the AccountServicing WSDL service, and click Next.

    WSDL Service screen

  10. Leave the values unchanged in the Info section, and click Next.

    API info

  11. In the Secure section, select the Limit API calls on a per key basis checkbox, and in the Activate API section, select the Activate API checkbox. Click Next.

    API Security and Publishing

  12. A Summary screen is now displayed, showing the steps to create and publish your new API. When this process is complete, you see a summary of the results, including the API Base Endpoint, and the credentials of the Sandbox Test Application that is automatically subscribed to the new API.

    Summary of results (top)

  13. Click Edit API. Your new API is now online.

    Design page (top)

You successfully created a REST API that invokes an existing SOAP service, and included it in a Product and Plan ready for testing. The WSDL file provided all the information that was needed to configure the API inputs and response.

Testing your API definition

Note: Due to Cross-Origin Resource Sharing (CORS) restrictions, the assembly test tool cannot be used with the Chrome or Safari browsers on the macOS Catalina platform.

To test your API definition by using the API Manager test tool, complete the following steps.

  1. Click the Assemble tab of the AccountServicing API, to move to the Assemble view, and click the Test icon The Test icon.

    Assemble view

    Note that the test panel is being deprecated, and will be moved to the Test tab in a future release.

  2. The Test panel opens, and you can see that the default Product and Plan that are needed for the test setup are listed.

    Test pane

  3. In the Operation section, select the post /getBalance operation to invoke.

    Select operation

  4. Scroll down in the Test panel to the request field, and click Generate to auto-generate a sample request.

    Generate request

  5. Click Invoke to test the API. The API response is displayed in the Response section. If you receive a message relating to an untrusted certificate, click the link provided, accept the certificate, then return to the test environment and click Invoke again.

    Successful invoke

    The Response section successfully returns the balance of the account.

What you did in this tutorial

In this tutorial, you completed the following activities:

  • Set up a REST API definition.
  • Configured the API based on a SOAP WSDL file, to invoke an existing web service and return its output.
  • Tested your API definition.