Skip to Content
Former Member
May 25, 2010 at 10:22 PM

How to resolve Content not allowed in prolog with PDF files


We are using PI 7.1 to read a file and using ASMA get the file name and pass it to a target mapping and call a web service with the file name.

We have a scenario that reads a PDF file as Binary form a folder. Our mapper uses ASMA to get the file name and folder of the

file to map to the target.

Testing in mapper works fine except for the ASMA does not function (known issue).

At runtime we drop a file and it is picked up as expected BUT from SXMB_MONI we see the following:

Runtime exception occurred during application mapping com/sap/xi/tf/_MM_FileNotification_; is not allowed in prolog.

This error does not happen all the time either. When it appears it is typically only the first time a file is mapped and on subsequent retries it processes normally. In dev we have shown that PI seems to get stuck on a few initial files u2013 process properly on the first retry and then at some point has no issues and will process files very fast.

u201CContent not allowed in prologu201D at least from an XML perspective is related to characters appearing before the xml file declaration:

<?xml version="1.0".encoding="UTF-8"?>

If chars appear before this you get this error in Java parsers. This could be related but we do not have control over how PI parsed the file content and puts into XML messages inside the mapper as we do nothing with the file content.

The same file will go through randomly with this exception on multiple drops. Sometimes it gets processed properly and sometime it doesnu2019t u2013 but in dev it u201Calwaysu201D gets processed properly on the automatic retry. It does not seem to matter what PDF we drop in there either.

Our tyoes look something like this:


DT_FILE - xsd:hexBinary


FilePath - xsd:String

I have tried with DT_FILE as xsd:base64Binary with the same results...

We use a UDF to get the file name from ASMA as follows:

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key1 = DynamicConfigurationKey.create("","FileName");

DynamicConfigurationKey key2 = DynamicConfigurationKey.create("","Directory");

String ourSourceFileName = conf.get(key1);

String ourSourceDirName = conf.get(key2);

//conf.put(key1, ourSourceDirName + "/" + ourSourceFileName);

return ourSourceDirName + "
" + ourSourceFileName;

Edited by: Carey Bingham on May 26, 2010 12:24 AM