cancel
Showing results for 
Search instead for 
Did you mean: 

Empty Message Handling - SAXParseException: Content is not allowed in prolog

Pranil1
Participant
0 Kudos

Hi All,

I am using ignore option of Empty Message Handling in receiver file adapter to avoid creation of 0 byte files. But the output payload is having root message, so it creates empty output file with zero byte size.

And as mentioned in mentioned in SAP Note 0000821267 - FAQ File Adapter, there are 2 solutions i.e. Java mapping and use of StrictXml2PlainBean.

I referred below links also and created java mapping.

http://scn.sap.com/thread/3162134

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/04/17/file-receiver-adapter-better-util...

At OM level it is generating blank output at the target.

It is removing the root tag and avoids the output file creation but the receiver CC channel is throwing below error.

“Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.lang.Exception: Exception in XML Parser (format problem?):'org.xml.sax.SAXParseException: Content is not allowed in prolog.'”

Also CC audit log shows message "Write to file <DIRECTORYPATH\FILENAME> as text (encoding UTF-8) size 1 bytes." 

I am trying to figure out the cause of 1 bytes size.

Please let me know your thoughts and if someone has faced similar issue, pls provide inputs.

Regards,

Pranil.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi Pranil,

Could you please let me know how the issue premature end of file is resolved.

Thanks & Regards,

Venkat

Pranil1
Participant
0 Kudos

Hi All,

Thanks a lot for your inputs.

Tried to find out the root cause of the error SAXParseException: Content is not allowed in prolog and found that in ESR at OM level when I run the Java mapping step, it gives a blank output removing root tag as required.

But when I clicked on the "pretty print" box of output, it gives me below error.

i.e. "org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of file. "

               

Trying to find out the reason for this error now.

Please let me know your thoughts and inputs.

Regards,

Pranil.

Former Member
0 Kudos

Hi,

thats great, as mentioned in my initial reply, can you try without encoding="utf-8" and re do the test locally.

Regards

Vishnu

iaki_vila
Active Contributor
0 Kudos

Hi Pranil.

it gives a blank output removing root tag as required.

The problem seems to be in the blank output, the PI expect a XML in the message mapping out and throws the exception that you see. Check the java mapping doesnt  remove all the message.

Regards.

Pranil1
Participant
0 Kudos

Hi Vishnu,

Do you mean removing the encoding="utf-8" from source payload and check?

I am already removing encoding as well as root tag and as shown in above screenshot, I am getting the blank output message.

Regards,

Pranil.

Former Member
0 Kudos

Hi,

Yes, am not talking about the part that is done by your maps/codes (removal of all the tags/ payload etc).

but, if it is possible to send your input as this <?xml version="1.0"?>, right from the beginning. Also check if the XML is well formed etc

Regards

Vishnu

Pranil1
Participant
0 Kudos

Hi Inaki,

Thanks for input.

I will try by keeping <?xml version="1.0"?> only in ouput .

Will update my findings.

Reagrds,

Pranil.

Former Member
0 Kudos

Hi,

Not in your output, but in your input XML and while mapping to an output etc (just before all your codes/ maps for doing removal of tags).

Regards

Vishnu

Former Member
0 Kudos

Hi Pranil,

Can you pls ask basis team to schedule a job called empty output generated.What it will do,it will automatically cancel those mesage which are not carrying any data and it will help you to improve the performance of the PI.

Regards,

Abhi

iaki_vila
Active Contributor
0 Kudos

Hi Vishnu,

A few cents,

Check this Shabarish Vijayakumar's  blog http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/08/16/the-mystery-of-content-is-not-all..., it could be helpful for you.

Regards.

ambrish_mishra
Active Contributor
0 Kudos

Hi Pranil,

Ideally after removing the root element, it should work fine and not create empty files.

please check the output of your Java mapping.

I looked around for this error....

Please check the link below:

http://scn.sap.com/thread/1765227

Copying some text from another link.

This error message is always caused by the invalid XML content in the beginning element. For example, extra small dot “.” in the beginning of XML element.

Any characters before the “<?xml….” will cause above “org.xml.sax.SAXParseException: Content is not allowed in prolog” error message.

Hope it helps!

Ambrish

Ambrish

Former Member
0 Kudos

Hi,

I suspect the issue is due to the (encoding="utf-8") in the prolog. if there is any way that you can get rid of this right from the beginning, then probably this issue may not arise. The encoding can cause some additional bytes/ spaces/ spl characters (invisible in the webbrowser).

What kind of mapping do you use? Just see if it is possible to have only <?xml version="1.0"?> in your message. At least to do a local test, to know if this is causing the issue.

good luck

Regards

Vishnu