...
- Log in to the API Publisher and click click ADD NEW API
- 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.
Select Generate REST APIs. Provide the WSDL URL given below for the SOAP backend and click click Start Creating.
Code Block title Sample WSDL URL http://ws.cdyne.com/phoneverify/phoneverify.asmx?wsdl
is is Pass Through.
The default option- Select the Generate REST APIs option and go to the Design tab
Go to the Design tab. Click on
EditEdit Source to edit the Swagger specification of the API.
- Click Apply Changes to save your API.
The generated API definitions are added to the API as shown below.
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.- 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.
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
<property name="HTTP_METHOD" value="POST" scope="axis2" type="STRING"/>Code Block 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
- Click Apply Changes to save your API.
The generated API definitions are added to the API as shown below.
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.- 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.
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.Enter the SOAP endpoint URL. The endpoint type should be
thethe HTTP/SOAP Endpoint
asas shown below.
Code Block title SOAP Endpoint URL http://ws.cdyne.com/phoneverify/phoneverify.asmx
- 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.
- Navigate to the API Store and and invoke the API.