Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Content is not allowed in prolog Error or Original Data Returned?

Avatar

Level 2

I am attempting to port our current java web application from Forms Server 7, to Forms Server 8 ES, and are having difficulties with processFormSubmission.

It seems that “processFormSubmission” does not process the document obtained from the servlet’s request.getInputStream(). As stated in the adobe specification if the processFormSubmission does not understand the document fomat it passes through the data without a change. This appears to be happening in this situation. The data in the request is the form client’s POST message which is the raw data from the HTML Form.

This POST message comes from the HTML form generated successfully by renderHTMLForm function. This worked in our original Livecycle 7 Forms Server, However, now in v8 Forms Server ES it doesn’t work anymore. I tried to extract the post message with base64 and decompress it without any positive results. If the CONTENT_TYPE variable is set to application/vnd.adobe.xdp the data is passed through without any processing, if the CONTENT_TYPE variable is set to application/vnd.adobe.xdp+xml the function processFormSubmission returns an Exception with the error “The content is not allowed in prolog”, which indicates that data are not in XML format.

The following is a sample of our Servlet code used to call processFormSubmission:

// FormsServiceClient object is obrained from service factory with properties

Properties connectionProps = new Properties();

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_DEFAULT_EJB_ENDPOINT, "jnp://localhost:1099");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_TRANSPORT_PROTOCOL,ServiceClientFactoryProperties.DSC_EJB_PROTOCOL);

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_SERVER_TYPE, "JBoss");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_USERNAME, "administrator");

connectionProps.setProperty(ServiceClientFactoryProperties.DSC_CREDENTIAL_PASSWORD, "pwd");

                                   

//Create a ServiceClientFactory object

ServiceClientFactory myFactory = ServiceClientFactory.createInstance(connectionProps);

                                   

//Create a FormsServiceClient object

FormsServiceClient formsClient = new FormsServiceClient(myFactory);

RenderOptionsSpec processSpec = new RenderOptionsSpec();

processSpec.setLocale("en_GB");

//adobe document created form request form client

Document formData = new Document(request.getInputStream());

// userAgent  -"Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2)"

FormsResult formRes1 = formsClient.processFormSubmission

(

formData,

"CONTENT_TYPE=application/vnd.adobe.xdp+xml",

userAgent,

processSpec

);

1 Accepted Solution

Avatar

Correct answer by
Level 2

We fixed this by setting the content type passed to processFormSubmission to be "application/x-www-form- urlencoded"  (rather than the types suggested in the docs)

View solution in original post

3 Replies

Avatar

Level 1

I get the same exception while trying to calculate or submit my HTML form, which works perfectly when rendered as a PDF. I can't find a solution yet, but passing in "CONTENT_TYPE=application/pdf&CONTENT_TYPE=application/vnd.adobe.xdp+xml&CONTENT_TYPE=text/html" allows me to use the PDF rendering mode without causing an exception in HTML mode.

BTW, I get form action 0 (submit) instead of 1 (calculate) when clicking on a button with a server-side JS script attached. The calculation is not performed, I get the submitted data back as unchanged with a content-type of text/html, when in fact it is application/x-www-form-urlencoded.

Avatar

Level 2

Hi Paul,

I am also getting the same issue of "Content is not allowed in prolog" when I try to submit the content format as "PDF" from the client, while, XDP format goes through. May I know, have you resolved the issue, if so, can you please post it to the forum.

Thanks

Gopala...

Avatar

Correct answer by
Level 2

We fixed this by setting the content type passed to processFormSubmission to be "application/x-www-form- urlencoded"  (rather than the types suggested in the docs)