Skip to content

Generate REST API from SOAP Backend

This feature allows users to expose their legacy SOAP backends as REST APIs through WSO2 API Manager. WSO2 API Manager supports WSDL 1.1 based SOAP backends.

Follow the instructions below to generate REST APIs in WSO2 API Manager for an existing SOAP backend.

Note

    Before you begin...
    Make sure that you have a valid WSDL URL from the SOAP backend. It should belong to the WSDL 1.1 version.

  1. Sign in to the API Publisher and click CREATE API

    Info

      There are two options to create APIs for SOAP backend
    • Pass Through – Create a pass through proxy for SOAP requests coming to the API Gateway
    • Generate REST APIs – This option is used to generate REST API definitions from the given WSDL URL

  2. Select Generate REST APIs and provide the WSDL URL for the SOAP backend. After, click NEXT button to proceed to the next phase.

  3. Provide the information in the table below and click CREATE button.

    Field Sample value
    Name PhoneVerification
    Context /phoneverify
    Version 1.0
    Endpoint http://ws.cdyne.com/phoneverify/phoneverify.asmx
    Business Plans Unlimited

  4. The created API appears in the publisher as follows.

  5. Navigate to the API Definition tab and click on Edit to modify the open API Definition of the API.

  6. The generated API resources are added to the API as shown below.

  7. Click on a resource to view the In and Out sequences of the API.

  8. The following sample shows the generated API In-sequence for a POST method.

           <header description="SOAPAction" name="SOAPAction" scope="transport" value="http://ws.cdyne.com/PhoneVerify/query/CheckPhoneNumber"/>
            <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
            <property expression="json-eval($.CheckPhoneNumber.LicenseKey)" name="req.var.CheckPhoneNumber.LicenseKey"/>
            <property expression="json-eval($.CheckPhoneNumber.PhoneNumber)" name="req.var.CheckPhoneNumber.PhoneNumber"/>
    
    
            <payloadFactory description="transform" media-type="xml">
            <format>
            <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://ws.cdyne.com/PhoneVerify/query">
            <soapenv:Header/>
            <soapenv:Body>
               <web:CheckPhoneNumber xmlns:web="http://ws.cdyne.com/PhoneVerify/query">
            <web:LicenseKey>$1</web:LicenseKey>
            <web:PhoneNumber>$2</web:PhoneNumber>
            </web:CheckPhoneNumber>
    
            </soapenv:Body>
            </soapenv:Envelope>
            </format>
            <args>
               <arg evaluator="xml" expression="get-property('req.var.CheckPhoneNumber.LicenseKey')"/>
            <arg evaluator="xml" expression="get-property('req.var.CheckPhoneNumber.PhoneNumber')"/>
    
            </args>
            </payloadFactory>
            <property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>

    The incoming JSON message parameters are stored using properties. The SOAP payload needed for the backend is generated using a payload factory mediator.

Top