fb
WSO2 Tutorial 3 min

How to add new SOAP APIs in WSO2 API Manager 2.6

Rob Blaauboer
Rob Blaauboer
Integration Consultant & WSO2 Trainer
yenlo blog 2020 02 20 add new soap api in wso2 apim 600x350
Scroll

How to add new SOAP APIs in WSO API Manager 2.6?The WSO2 API Manager 2.6 supports SOAP APIs as well as REST and Websockets. Most of the time we actually create APIs, since it’s called the API Manager. But there are other possibilities to create APIs that actually use a SOAP service in the backend. You can also do this with the WSO2 API Manager 2.6 fronting the WSO2 Enterprise Integrator but the API Manager has support for this and if the mediation is minimal this is feasible.

We will use a SOAP service to use SOAP in the WSO2 API Manager 2.6. We will add a new API that points to a SOAP Backend. We will first use the passthrough option.

Supporting SOAP APIs | Figure 1

After starting the WSO2 API Manager 2.6, log in to the API Publisher and create a new API, using the WSDL mentioned above.

After clicking Start Creating and fill in the details:

Name Factbook_Pass_Through
Context /factbook
Version 1.0
Thumbnail image Download the image

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-2
Click on implement to go to the second tab and fill in the following details:

Endpoint HTTP/SOAP Endpoint
Production http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-3
Click on Manage and fill in these details:

Make this the default version: unchecked
No default version defined for the current API
Transports: select HTTPS HTTP
Response Caching:
Authorization Header:
Throttling Settings
Maximum Backend Throughput: Unlimited
Subscription Tiers: Unlimited : Allows unlimited requests
Advanced Throttling Policies: Apply to API  / Unlimited

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-4
Leave the Resources as configured automatically.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-5

Press Save & Publish to Publish the API.

See the API in the Publisher.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-6

API REST

Let’s create a second version, this time we will create the REST APIs.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-7

Name Factbook_Pass_Through
Context /factbook
Version 1.0
Thumbnail image Download the image

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-8

See the API Definition that was created based on the WSDL.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-9
Press Implement to go to the next tab.

Fill in the details the same as before.

Endpoint HTTP/SOAP Endpoint
Production http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso

See that there’s a mapping defined.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-10
Clicking on language shows the translation from REST TO SOAP.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-11

Press on Manage Button.

Fill in these details.

Make this the default version: unchecked
No default version defined for the current API
Transports: select HTTPS HTTP
Response Caching:
Authorization Header:
Throttling Settings
Maximum Backend Throughput: Unlimited
Subscription Tiers: Unlimited : Allows unlimited requests
Advanced Throttling Policies: Apply to API  / Unlimited

See that there’s a list of resources defined.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-12
Press Save & Publish.

Go to the store and see the two APIs.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-13

Sign in using admin/admin credentials and create a new application called CIA. Generate the client key / secret pair.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-14

Subscribe to the Pass_Through API using the CIA application and Go to the API Console.

Click Try it and fill in this SOAP Message:

<soapenv:Envelope xmlns_soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns_web="http://www.oorsprong.org/websamples.countryinfo">
<soapenv:Header/>
<soapenv:Body>
<web:CapitalCity>
<web:sCountryISOCode>NLD</web:sCountryISOCode>
</web:CapitalCity>
</soapenv:Body>
</soapenv:Envelope>

NOTE: you can create this by using SoapUI and the wsdl on a new SOAP Project.

And SOAPAction           sCountryISOCode

If you do not see a response copy the response URL https://192.168.122.1:8243/factbook/1.0/* to the browser and copy it in the URL bar. Press enter. This will trigger the security exception and add an exception.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-15

This is the response, giving the capital city of The Netherlands.

<soap:Envelope>
<soap:Body>
<m:CapitalCityResponse>
<m:CapitalCityResult>Amsterdam</m:CapitalCityResult>
</m:CapitalCityResponse>
</soap:Body>
</soap:Envelope>

Also subscribe to the Factbook_API and test the REST API /capitalCity with a sCountryISOCode NLD.

yenlo_blog_2020-02-20_supporting-soap-apis_screenshot-16

The JSON response is:

{
"CapitalCityResponse": {
"CapitalCityResult": "Amsterdam"
}
}

You now have two API’s that talk to a SOAP backend service, one that simply passes the message and another one that has a REST frontend to the SOAP backend.

Full API lifecycle Management Selection Guide

WHITEPAPER

smartmockups l0qqucke