FAQ: The 'Content Not Allowed in Prolog' and 'Premature End of File' Errors


The "Content Not Allowed in Prolog" error typically indicates an XML document based task (Map to XML, Map From XML, WS Security, SAML, etc...), is failing because the current document in the Sentry processing engine (in memory) is not an XML document.

The "Premature end of file" error typically indicates a task to modify a document fails because there is no document in the processing engine.



While there are several use cases in which these errors might come up, a common one for both is JSON to XML conversion, outlined below.

The use case is JSON to XML conversion, with Sentry consuming Basic Auth credentials, converting the JSON to XML, then adding the user credentials to the SOAP in the form of a SAML Assertion. 

If the initial request is a blank document, the "Premature end of file" error is thrown. This commonly happens if you try to test the service with a browser, using an HTTP GET, which of course has no document.

If the initial request is a POST of JSON data (as expected), the "Content not allowed in Prolog" error is thrown if a task tries to modify the JSON document before it is converted to XML format. For instance, if the SAML assertion task (to add a SAML) runs prior to the Convert JSON to XML task runs.



If you are receiving these errors, check the task list and the order of the processing. Remember that the document to be processed may change with each task that is run, and if there is a task in the list to modify or add to the XML in some way, the current document when that task runs need to be an XML document.

Check the HTTP Method of the request. If it's a GET request, there is no request document provided by the client so any document based task will fail until there is a document loaded (sometimes done with the Replace Document task).

Enable DEBUG level logging then reproduce the problem. Step through the log to see the incoming HTTP headers / Method and check all tasks and processing happening for the transaction.

If further assistance is necessary open a new ticket with Forum Systems support and provide:

  1. System log at DEBUG showing the full transaction and error
  2. FSG file for the Content Policy or at least the Task List Group



Article is closed for comments.