Membrane API Gateway returns 405 Method Not Allowed or 400 Bad Request when the wsdl2openapi plugin, which exposes a SOAP service as a REST API, rejects a request before converting it to SOAP. The request does not fit the generated API.
The response contains the problem type https://membrane-api.io/problems/user and a link to this page. The type user means that the request caused the problem, not an internal failure of the gateway. Status, title and detail depend on the case:
The title is Method not allowed and the detail is The requested path does not support GET. Allowed: POST. The Allow header of the response lists the allowed methods.
The title is Invalid query string and the detail is The query string could not be parsed. Check for duplicate or malformed parameters.
The title is Invalid field name and the detail is A field name in the request body cannot be mapped to XML.
The wsdl2openapi plugin reads a WSDL and offers each SOAP operation as a REST endpoint with a generated OpenAPI document. It converts JSON requests and query parameters into SOAP messages and the SOAP responses back into JSON. By default, operations are exposed with POST. Under operations, you can give each operation its own method and path. See WSDL to OpenAPI Converter and SOAP to REST Gateway.
api:
port: 2000
flow:
- wsdl2openapi:
wsdl: partner.wsdl
operations:
getPartner:
method: GET
path: /partners/{id}
api:
port: 2000
flow:
- wsdl2openapi:
wsdl: partner.wsdl
operations:
getPartner:
method: GET
path: /partners/{id}
The path belongs to an operation, but the request uses another method than the one exposed for it, for example GET for an operation that is exposed with the default POST.
For an operation that takes query parameters, the query string contains the same parameter name twice, as in ?id=7&id=8, or has a broken percent-encoding.
A property name in the JSON request body is not a legal XML element name, for example because it starts with a digit or contains a space, as in {"1st name": "Ann"}. It cannot be mapped to an element of the SOAP message.
/api-docs and use the method, path and parameters it describes.method for it under operations.By default, Membrane runs in development mode and adds details to error responses that help you find the problem. These details may reveal information about your setup. In production, turn them off:
configuration:
production: trueconfiguration: production: true
Add the configuration document to your apis.yaml and separate it from the APIs with ---.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.