description |
---|
This page provides the technical details of the REST to SOAP policy |
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:
{% 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 %}
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 %}
The phases checked below are supported by the rest-to-soap
policy:
v2 Phases | Compatible? | v4 Phases | Compatible? |
---|---|---|---|
onRequest | true | onRequest | true |
onResponse | false | onResponse | false |
onRequestContent | false | onMessageRequest | false |
onResponseContent | false | onMessageResponse | false |
The rest-to-soap
policy can be configured with the following options:
Property | Required | Description | Type | Default |
---|---|---|---|---|
SOAP Envelope | true | SOAP envelope used to invoke WS (supports Expression Language) | ||
SOAP Action | false | 'SOAPAction' HTTP header sent when invoking WS | ||
Charset | false | This charset will be appended to the Content-Type header value | ||
Preserve Query Parameters | false | Whether the query parameters are propagated to the backend SOAP service |
The following is the compatibility matrix for APIM and the rest-to-soap
policy:
Plugin version | Supported APIM versions |
---|---|
1.x | All |
{% @github-files/github-code-block url="https://github.com/gravitee-io/gravitee-policy-rest-to-soap/blob/master/CHANGELOG.md" %}