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.
For 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
.
You can configure the policy with the following options:
Property | Required | Description | Type | Default |
---|---|---|---|---|
SOAP Envelope |
X |
SOAP envelope used to invoke WS (supports Expression Language) |
||
SOAP Action |
'SOAPAction' HTTP header sent when invoking WS |
|||
Charset |
This charset will be appended to the |
|||
Preserve Query Parameters |
Whether the query parameters are propagated to the backend SOAP service |
"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
}