Skip to content

Latest commit

 

History

History
83 lines (59 loc) · 3.76 KB

File metadata and controls

83 lines (59 loc) · 3.76 KB
description
This page provides the technical details of the REST to SOAP policy

REST to SOAP

Overview

You can use the rest-to-soap policy to expose SOAP backend service as a REST API. The policy will pass the SOAP envelope message to the backend service as a POST request. SOAP envelopes support Expression Language to provide dynamic SOAP actions.

Functional and implementation information for the rest-to-soap policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v2 APIs and v4 HTTP proxy APIs. It cannot be applied to v4 message APIs or v4 TCP proxy APIs. {% endhint %}

{% tabs %} {% tab title="HTTP proxy API example" %} A SOAP API http(s)://GATEWAY_HOST:GATEWAY_PORT/soap?countryName=France with the following rest-to-soap policy SOAP envelope content:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope\\\" xmlns:web=\\\"http://www.oorsprong.org/websamples.countryinfo">
   <soap:Header/>
   <soap:Body>
      <web:CountryISOCode>
         <web:sCountryName>{#request.params['countryName']}</web:sCountryName>
      </web:CountryISOCode>
   </soap:Body>
</soap:Envelope>

Will give you the ISO country code for France. {% endtab %} {% endtabs %}

Configuration

Sample policy configuration is shown below:

{% code title="Sample Configuration" %}

"rest-to-soap": {
  "envelope": "<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.oorsprong.org/websamples.countryinfo">
                 <soap:Header/>
                 <soap:Body>
                    <web:ListOfCountryNamesByName/>
                 </soap:Body>
              </soap:Envelope>",
  "soapAction": null
}

{% endcode %}

Phases

The phases checked below are supported by the rest-to-soap policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequesttrueonRequesttrue
onResponsefalseonResponsefalse
onRequestContentfalseonMessageRequestfalse
onResponseContentfalseonMessageResponsefalse

Options

The rest-to-soap policy can be configured with the following options:

PropertyRequiredDescriptionTypeDefault
SOAP EnvelopetrueSOAP envelope used to invoke WS (supports Expression Language)
SOAP Actionfalse'SOAPAction' HTTP header sent when invoking WS
CharsetfalseThis charset will be appended to the Content-Type header value
Preserve Query ParametersfalseWhether the query parameters are propagated to the backend SOAP service

Compatibility matrix

The following is the compatibility matrix for APIM and the rest-to-soap policy:

Plugin version Supported APIM versions
1.x All

Changelogs

{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-rest-to-soap/blob/master/CHANGELOG.md" %}