Open Source API Gateway

400 Bad Request: Could Not Generate XML from HTTP Information

Membrane API Gateway returns 400 Bad Request with the detail Could not generate XML from HTTP information! when the http2xml plugin cannot turn the incoming request into its XML representation. The request flow is aborted.

The Error Response

The response contains the status 400 Bad Request, the detail Could not generate XML from HTTP information!, the problem type https://membrane-api.io/problems/user and a link to this page. The type user means that the request the client sent triggered the problem. In development mode, the response also contains the underlying error.

What the http2xml Plugin Does

The http2xml plugin converts the request, with its method, URI, headers and body, into an XML document that describes the HTTP message. Following plugins, such as XSLT transformations, can then process the whole request as XML. The plugin is experimental.

Common Causes

The Request URI Cannot Be Parsed

The request URI is not a valid URI, for example because it contains unencoded spaces or other illegal characters. Characters like spaces, | or ^ must be percent-encoded.

The XML Body Is Not Well-Formed

The request is declared as XML by its Content-Type, but the body is not well-formed XML or ends before the document is complete.

The JSON Body Is Invalid

The request is declared as JSON, but the body is not valid JSON.

The Body Cannot Be Read

The request body cannot be read or decoded, for example because of a broken Content-Encoding.

How to Fix It

  1. Client: percent-encode the request URI correctly.
  2. Client: send a body that matches its Content-Type.
  3. Operator: check the gateway log. The plugin logs the full error at error level.

Hide Details in Production

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: true
configuration:
  production: true

Add the configuration document to your apis.yaml and separate it from the APIs with ---.

Related Documentation

Configuration reference:

← All Membrane error messages

Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.