Search

Convert SOAP service to REST API

Business Problem

You would like to use Infor OS to integrate into another system via APIs, but that system only offers SOAP web services. Infor OS prefers REST APIs, so how can you create a modern integrated solution?


Components

Requirements

  • Access to ION API Gateway
    • Security role: IONAPI-Administrator
    • Security role: IONAPI-User
  • API (REST vs SOAP) knowledge
  • Handlebars script knowledge for Policy Docs

Tutorial

SOAP Webservices are still a valid option in the API world. They are based on WSDL (Web Service Definition Language) an XML file where you can define the input and the output with the types of messages. This approach is completely different compared to the REST (REpresentational State Transfer) that is based on swagger documentation 2.0 or Open API 3.0.x.

Unless it is possible to define SOAP web service in the API gateway, we cannot use it in ION, because the ION API connector is based on an API suite based on REST.

By the way with the use of the API Policy, we can convert a SOAP web service into a REST API, and for doing that we use this WSDL

https://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL

Once we have the URL (Uniform Resource Locator) of the WSDL we can register a new custom API suite in the Infor API Gateway, but we need also swagger documentation or an Open API 3.0.x to document our endpoint, which you can find at the bottom the swagger file, that has to be uploaded in our API suite

The next step is the most important one where we define the Endpoint Policy for Request and Response. we have to write the script that converts JSON input from REST API to XML for SOAP and the other way around, a script that converts XML to JSON as a response

From JSON to XML (Request)

<jsonTransform continueOnError="false" displayName="jsonTransformMingle01"
               enabled="true" name="JSONTransformMingle01" version="1"
    xmlns="http://www.infor.com/ion/api"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.infor.com/ion/api jsonTransform.xsd">
    <transformations>
        <transform kind="handlebars" outputType="text/xml;charset=UTF-8"><![CDATA[<soap:Envelope
            xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
            xmlns:web="http://www.dataaccess.com/webservicesserver/"><soap:Header/><soap:Body><web:NumberToWords><web:ubiNum>{{number}}</web:ubiNum></web:NumberToWords></soap:Body></soap:Envelope>
]]>
        </transform>
    </transformations>
</jsonTransform>

From XML to JSON (Response)

<jsonTransform continueOnError="false" displayName="jsonTransformMingle01"
               enabled="true" name="JSONTransformMingle01" version="1"
    xmlns="http://www.infor.com/ion/api"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://www.infor.com/ion/api jsonTransform.xsd">
    <transformations>
        <transform kind="handlebars" outputType="application/json">
            <![CDATA[{"text": "{{jsonPathValue '$..m:NumberToWordsResponse.m:NumberToWordsResult'}}"}]]>
        </transform>
    </transformations>
</jsonTransform>

Register custom API Suite

Upload swagger documentation

Create Request and Response Policies

Test API

Test ION API Connection Point

Downloads