How can a SOAP operation be exposed as a REST-style GET API?
Place the Membrane API Gateway between client and service and implement a REST-to-SOAP facade. The gateway converts an HTTP GET request into a SOAP request and transforms the XML response into JSON for the client.

To set up the REST-to-SOAP converter, define the following API:
api:
port: 2000
method: GET
path:
uri: /cities/{city}
flow:
- request:
- soapBody:
src: |
<getCity xmlns="https://predic8.de/cities">
<name>${pathParam.city}</name>
</getCity>
- setHeader:
name: SOAPAction
value: https://predic8.de/cities/get
- response:
- template:
contentType: application/json
src: |
{
"country": ${xpath('//country')},
"population": ${xpath('//population')}
}
target:
method: POST
url: https://www.predic8.de/city-service
api:
port: 2000
method: GET
path:
uri: /cities/{city}
flow:
- request:
- soapBody:
src: |
<getCity xmlns="https://predic8.de/cities">
<name>${pathParam.city}</name>
</getCity>
- setHeader:
name: SOAPAction
value: https://predic8.de/cities/get
- response:
- template:
contentType: application/json
src: |
{
"country": ${xpath('//country')},
"population": ${xpath('//population')}
}
target:
method: POST
url: https://www.predic8.de/city-service
Membrane includes ready-to-run tutorial examples. You can try this setup in about 10 minutes.
You can then adapt the configuration to your own use case. Explore additional examples in the transformation folder.