Skip to main content

soap

The soap plugin provides a convenient approach to transform between RESTful HTTP requests and SOAP requests, as well as their corresponding responses.

With a single URL to the WSDL file, API7 automatically parses the file content and generates conversion logics to allow for the protocol transcoding.

Examples

Prerequisites

The soap plugin depends on soap-proxy, a separate service that handles WSDL parsing and JSON-to-SOAP transcoding. For Docker deployments, start soap-proxy before using the plugin. For Helm deployments, enable the chart-managed soap-proxy sidecar when configuring the gateway values.

Start SOAP Proxy

Start the soap-proxy container on the same network as your APISIX instance (adjust accordingly for your environment):

docker run -d \
--name soap-proxy \
--network=apisix-quickstart-net \
-p 5000:5000 \
api7/soap-proxy:1.0.0

Configure the Gateway

By default, the soap plugin expects soap-proxy to be available at http://127.0.0.1:5000. Update the gateway static configuration to point the plugin to the proxy service address used by your deployment:

Add the following to your config.yaml:

config.yaml
plugin_attr:
soap:
endpoint: http://soap-proxy:5000
timeout: 3000

Reload the gateway for the changes to take effect:

apisix reload

Invoke an Operation

The following example demonstrates how you can configure the plugin on a route and invoke an operation available on the upstream server as specified in the WSDL file.

Create a route with the soap plugin:

curl "http://127.0.0.1:9180/apisix/admin/routes" -X PUT \
-H 'X-API-KEY: ${ADMIN_API_KEY}' \
-d '{
"id": "soap-hello",
"uri": "/SayHello",
"methods": ["POST"],
"plugins": {
"soap": {
"wsdl_url": "https://apps.learnwebservices.com/services/hello?wsdl"
}
}
}'

❶ Set the URI to the name of the operation in the WSDL file.

❷ Allow only for the POST request method.

❸ Set the URL path to the WSDL file.

Send a request to the route to verify:

curl "http://127.0.0.1:9080/SayHello" -X POST -d '{"Name": "John Doe"}'

You should see an HTTP/1.1 200 OK response with the following:

"Hello John Doe!"