Membrane API Gateway returns an error when the rest2Soap plugin cannot convert a REST request into a SOAP request, or the SOAP response back into a REST response. The cause can be the request, the backend response or the stylesheets of the mapping.
The response contains the title User error., the exception, the problem type https://membrane-api.io/problems/user and a link to this page. Status and detail depend on the direction:
The status is 400 Bad Request and the detail is Could not covert REST to SOAP!. The request did not reach the backend.
The detail is Could not covert SOAP to REST!. The error happens in the response flow, so the client receives 500 Internal Server Error. In production mode, the title is replaced by Internal Server Error.
The rest2Soap plugin offers a REST interface for a SOAP service. For each mapping, a regex selects the requests, soapURI and soapAction address the SOAP operation, and two XSLT stylesheets do the conversion. Membrane turns the REST request into an XML document and applies requestXSLT to create the SOAP message. The SOAP response is converted with responseXSLT, and to JSON if the client asked for JSON.
The request URI cannot be parsed, or the request body is declared as XML or JSON in its Content-Type but is not well-formed. Membrane then cannot build the XML document for the stylesheet.
The stylesheet in requestXSLT or responseXSLT cannot be found or does not compile. Stylesheets are loaded on first use, so this shows up when the first request arrives, not at startup.
The stylesheet fails at runtime, for example through an xsl:message terminate="yes" or an error in an XPath expression.
In the response flow, the backend returns something other than a SOAP message, for example an HTML error page, or the conversion to JSON for a client that sent a JSON Accept header fails.
Content-Type.requestXSLT and responseXSLT locations of the mapping, and test the stylesheets against sample messages.soapURI of the mapping.For new projects, consider the SOAP to REST Gateway, which generates the REST API from the WSDL without stylesheets.
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:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.