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, in IBM® API
Connect Version 5.0.7 and
later.
About this tutorial
In API Manager, you will create a REST API that accesses a SOAP API to make data from the existing SOAP service available. This tutorial uses the same SOAP service as the Tutorial for creating a SOAP API tutorial, but exposes it in a different way.
Setting up a REST API definition
To set up a REST API, complete the following steps:
- In API Manager, if you have not previously pinned the UI
navigation pane then click the Navigate to icon
. The API Manager UI navigation pane
opens. To pin the UI Navigation pane, click the Pin menu icon
.
- Click Drafts in the UI navigation pane and
then click the APIs tab. The APIs tab opens.
- Click .
- Specify basic information about the API.
- In the Title field, enter Accounts.
- Leave the Name field as accounts when it is filled while you enter your title.
- Leave the Base Path field as /accounts.
- Leave the Version field as 1.0.0.
- Expand Additional properties to specify additional properties for the API.
- From the API template field, select Default to indicate that you want to use the default template to create the API definition.
- Leave the remaining fields unchanged.
- Add your API to a new Product and then create the API definition.
- Click Add a product.
- In the Title field, enter BankA Services.
- Leave the Name and Version fields unchanged.
- Ensure that the Publish this product to a catalog check box is selected and then select Sandbox as the target Catalog.
- Click Create API. The Design tab for the draft of your API definition opens.
- In the Definitions section, click the Add
Definition icon
and then expand the new Definition by clicking it.
- In the Name field rename the Definition to Account
Output.
- In the Properties subsection of the Definition is a single property called
new-property-1. Rename the property to Balance, and in
the TYPE column select double. Select the check box in
the * column to mark the property as required.
Marking a property as
required is indicated to users in the OpenAPI (Swagger 2.0) definition of the API
and can be enforced by a validate policy.
- In the Paths section, click the Add Path icon
, and then expand the new Path by clicking it.
- In the Path field of your newly created Path, replace the contents with /balance.
- In the Parameters subsection of the Path, expand the GET
/balance operation by clicking it.
- In the Parameters subsection for the GET /balance
operation, click Add Parameter and then click Add new
parameter.
- Name your new parameter customer_id, and in the
TYPE column select number-double. Select the check box
in the REQUIRED column to mark the property as required.
Marking a
property as required is indicated to users in the OpenAPI (Swagger 2.0) definition of the API,
is enforced by validate policies, and results in the test tool always generating the parameter as
part of a sample API call.
- In the Schema column of the 200 OK response in the
Responses subsection, select your Account Output
definition.
- Click the Save icon
to save your changes.
Testing your API definition
To test your API definition by using the API Manager test tool, complete the following steps:
- Click the Test icon
. The test tool opens.
- If you have used the test tool before, click Change setup.
- In the Catalog field, select your Sandbox Catalog.
- In the Product field, select your BankA Services Product and then click Republish product to publish your Product so that it can be tested.
- Click Next.
- In the Operation field, select get /balance.
- In the customer_id field, enter 12345.
- Click Invoke. The response is displayed.
Note: If you are using a self-signed certificate, you might be prompted to visit a provided URL. Click the link and then accept the certificate before returning to API Manager and clicking Invoke again.
What you did in this tutorial
In this tutorial, you completed the following activities:
- Set up a REST API definition
- Configured an API to invoke an existing web service and return its output
- Tested your API definition