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, APISIX automatically parses the file content and generates conversion logics to allow for the protocol transcoding.
Examples
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 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!"