> For the complete documentation index, see [llms.txt](https://audomsak.gitbook.io/3scale/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://audomsak.gitbook.io/3scale/documents/expose-soap-api.md).

# Expose SOAP API Through API Gateway

## Steps

* [1. Create Backend API](#1-create-backend-api)
* [2. Add Backend to Product](#2-add-backend-to-product)
* [3. Configure Mapping Rules](#3-configure-mapping-rules)
* [4. Promote Changes to APIcasts (API Gateways)](#4-promote-changes-to-apicasts-api-gateways)
* [5. Testing](#5-testing)

## 1. Create Backend API

1. Go to OpenShift web console, make sure you're in **Administrator** perspective, change Project to **demo**, then go to **Networking -> Services** menu, and then click on the service you need to expose it's API(s) through API gateway.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-4a5129ed41aade4687debf76761c1ec5290a2a8c%2Fexpose-soap-api-1.png?alt=media)
2. Copy the **Hostname** of the service and note the port number as well. Note that we use the Service object hostname instead of the Route's URL because:

   * the API gateway (APIcast) is deployed on the same cluster so it can internally access the Service in different projects/namespaces.
   * We need API consumers to access the API via API gateway only so the (public) Route's URL shouldn't be used and should be deleted later.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-7739a3985fbae7a47f3b928c29fd6d424c31a144%2Fexpose-soap-api-2.png?alt=media)
3. Open 3scale API Management admin web console using the URL and credential provided at the end of the [installation process](/3scale/readme.md#installation-steps). Then from the main dashboard, click on **Create Backend** button.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-4a8843cf9c5a297c524f1c2d0907127a43343cb0%2Fexpose-soap-api-3.png?alt=media)
4. Enter following details then click **Create Backend** button.

   * **Name:** `Employee SOAP Service Backend`
   * **Private Base URL:** `http://employee-soap.demo.svc.cluster.local:8080/soap/service/employee`

   Note. **System name** and **Description** are optional fields.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-553bc93bf1a7ad7d50dbe500b26864570929e113%2Fexpose-soap-api-4.png?alt=media)
5. A new backend should be created.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-dc3b534e23951b1c7b7b6e4acdf248da520b673c%2Fexpose-soap-api-5.png?alt=media)

## 2. Add Backend to Product

1. Click on dropdown list menu then select **Product**.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-ccba8b05bf7cb25ed3089d4d9a340a6c79521d45%2Fexpose-soap-api-6.png?alt=media)
2. Click **Human Resource Services** link.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-7496bb13af01b49a7f383b8602b6f698f59fc4b9%2Fexpose-soap-api-7.png?alt=media)
3. Select **Integration -> Backends** menu from left panel.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-7871a3136d0f458d4656636a9ffcc25e47b79562%2Fexpose-soap-api-8.png?alt=media)
4. Click **Add Backend** button.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-8adeacb4bf7667e2556f8da4940a2a0863b02c24%2Fexpose-soap-api-9.png?alt=media)
5. Enter following details then click **Add to Product** button.

   * **Backend:** `Employee SOAP Service Backend`
   * **Path:** `/soap/employee`

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-6916f7451ba78d492be9436db95c8142fff0e840%2Fexpose-soap-api-10.png?alt=media)
6. A new backend should be added.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-baf0f2c8c272a3389f793e052f46568e763cab07%2Fexpose-soap-api-11.png?alt=media)

## 3. Configure Mapping Rules

1. Select **Integration -> Mapping Rules** menu from left panel, then click **Create Mapping Rule** button.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-14a94cef15b2614edbf0a6b72f4a40f10a678978%2Fexpose-soap-api-12.png?alt=media)
2. Enter following details then click **Create Mapping Rule** button.

   * **Verb:** `POST` (HTTP method for a particular API)
   * **Pattern:** `/soap/employee` (A particular REST API endpoint exposed via API gateway)
   * **method or Metric to increment:** Select `Metric` option and `Hits` from dropdown list menu.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-88a3951513ef6bd6e1a787409d9f3188668caeb3%2Fexpose-soap-api-13.png?alt=media)
3. A new Mapping Rule should be created.

   ![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-604ff646010b57b134a355b052958c2ef8da8b73%2Fexpose-soap-api-14.png?alt=media)

## 4. Promote Changes to APIcasts (API Gateways)

Once we've configured everything in place in API Manager, we have to promote all changes to API Gateway (APIcast) to apply those changes.

Click on **Integration -> Configuration** menu from left panel. Then click **Promote v.*****N*****&#x20;to Staging APIcast** button to promote changes to staging API gateway and click **Promote v.*****N*****&#x20;to Production APIcast** button to promote changes to production API gateway.

![expose soap api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-8df13b73231425f08113bcdc2b5a48f107c7850e%2Fexpose-soap-api-15.png?alt=media)

## 5. Testing

1. Click on **Applications -> Listing** menu from left panel. Then click **Test Corp HR Mobile** link to open Application dashboard.

   ![expose rest api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-eec766e1bb65fab2d228c227d6da384df4009b65%2Fexpose-rest-api-38.png?alt=media)
2. Copy User Key.

   ![expose rest api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-3fbcf5f3f8ef8e64933731797d0b7ab9525a7f9a%2Fexpose-rest-api-39.png?alt=media)
3. Open Postman then update `user-key` variable and click **Save** button.

   ![expose rest api](https://3707709575-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FlMgVlX77EAThg6NrNt4u%2Fuploads%2Fgit-blob-1a6f8dcf7d3c7459c0b23ce98f3c675f3dbd3d6c%2Fexpose-rest-api-40.png?alt=media)
4. [Test the APIs](/3scale/documents/testing-application.md#testing-apis) using [3Scale API Testing (API Key Auth)](https://github.com/audomsak/redhat-3scale-api-management/blob/main/postman/3scale-api-testing-api-key-auth.postman_collection.json) collection.
