Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Tested and updated for 2.2.0

...

  1. Log in to the API Publisher and click click ADD NEW API
  2. Select Select I Have a SOAP Endpoint. You see the following 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 URLWSDL URL.
  3. Select Generate REST APIs. Provide the WSDL URL given below for the SOAP backend and click click Start Creating

    Code Block
    titleSample WSDL URL
    http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl

    Image AddedThe default option is is Pass Through. Image Removed

  4. Select the Generate REST APIs option and go to the Design tab

    Go to the Design tab. Click on

    Edit

     Edit Source to edit the Swagger specification of the API.
    Image Modified

  5. Click Apply Changes to save your API.
    Image Removed
  6. The generated API definitions are added to the API as shown below.
    Image Removed

    Note

    The definition properties are mapped with a Swagger vendor-specific field x-xpath, which is used to map the SOAP binding operation parameters with the REST parameters. If a parameter does not have this field it is not mapped with a backend operation. To ensure the mapping functions smoothly, do not make any changes to the properties.

  7. Go to the Implement tab and view the SOAP Mapping section. Click on a resource to view the In and Out sequences of the API.
    Image Removed
  8. The following sample shows the generated API In-sequence for a GET method with query parameters.

    Code Block
    GET https://<host_name>:8243/weather/1.0.0/weather?CityName=xxxxx&CountryName=xxxxx
    Code Block<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>

    Copy and paste the following code

    Code Block
    swagger: "2.0"
    paths:
      /CheckPhoneNumber:
        get:
          responses:
     <header name="SOAPAction"      "200":
              description: scope="transport"
          produces:
            - application/xml
       value="http://www.webserviceX.NET/GetWeather"   consumes:
            - application/json
         description="SOAPAction"/>
     parameters:
            <property- name="REST_URL_POSTFIX" scope="axis2" action="remove"/>: Phone Number
             <property name="req.var.CityName" expression="$url:CityName"/>
     in: query
            <property name="req.var.CountryName" expression="$url:CountryName"/> required: true
             <payloadFactory media-type="xml" description="transform">type: string
              description: "Give <format>the phone number to be validated"
            -  <soapenvname:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"LicenseKey"
              in: query
              required: true
              xmlns:web="http://www.webserviceX.NET">
    type: string
              description: "Give the license key as 0 <soapenv:Header/>for testing purpose"
        post:
               <soapenv:Body>parameters:
            - name: Payload
              <webdescription:GetWeather> Request Body
              required: false
              <web:CityName>$1</webin:CityName> body
              schema:
                <webtype:CountryName>$2</web:CountryName> object
                properties:
           </web:GetWeather>       payload:
               </soapenv:Body>     type: string
             </soapenv:Envelope>responses:
            "200":
       </format>       description: ""
    info:
      title: <args>PhoneVerification
      version: 1.0.0
  9. Click Apply Changes to save your API.
    Image Added
  10. The generated API definitions are added to the API as shown below.
    Image Added

    Note

    The definition properties are mapped with a Swagger vendor-specific field x-xpath, which is used to map the SOAP binding operation parameters with the REST parameters. If a parameter does not have this field it is not mapped with a backend operation. To ensure the mapping functions smoothly, do not make any changes to the properties.

  11. Go to the Implement tab and view the SOAP Mapping section. Click on a resource to view the In and Out sequences of the API.
    Image Added
  12. The following sample shows the generated API In-sequence for a GET method with query parameters.

    Code Block
    GET https://<host_name>:8243/phoneverify/1.0.0/CheckPhoneNumber?Phone%20Number=XXXXXXXX&LicenseKey=0
    Code Block
    <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  <arg evaluatorexpression="xml$url:PhoneNumber" expressionname="get-property('req.var.CityName')PhoneNumber"/>
                   <arg evaluator="xml" expression="get-property('<property expression="$url:LicenseKey" name="req.var.CountryName')LicenseKey"/>
    
    
    <payloadFactory description="transform" media-type="xml">
      <format>
      <soapenv:Envelope  </args>
             </payloadFactory>
             <property name="messageType"
                       value="application/soap+xml"
                       scope="axis2"
                       type="STRING"
                       description="messagePropertyxmlns:soapenv="http://schemas.xmlsoap.org/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:PhoneNumber>$1</web:PhoneNumber>
       <web:LicenseKey>$2</web:LicenseKey>
    </web:CheckPhoneNumber>
    
      </soapenv:Body>
      </soapenv:Envelope>
      </format>
      <args>
     	<arg evaluator="xml" expression="get-property('req.var.PhoneNumber')"/>
    <arg evaluator="xml" expression="get-property('req.var.LicenseKey')"/>
    
      </args>
    </payloadFactory>
    <property description="messageProperty" name="messageType" scope="axis2" type="STRING" value="application/soap+xml"/>

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

  13. Enter the SOAP endpoint URL. The endpoint type should be

    the

    the HTTP/SOAP Endpoint

    as

     as shown below.

    Code Block
    titleSOAP Endpoint URL
    http://ws.cdyne.com/phoneverify/phoneverify.asmx


    Image Modified

  14. Go to the the Manage tab  tab and select the relevant configurationconfigurations. Click Click Publish to  to publish the API to the API Store. For instructions, see Create and Publish an API.
  15. Navigate to the API Store and and invoke the API.