cancel
Showing results for 
Search instead for 
Did you mean: 

Empty file creation in PI 7.3

Former Member
0 Kudos

Hello, I've implemented a proxy-to-file scenario in PI 7.3 dual-stack installation. I've used content conversion in the receiver adapter as follows:

Message Structure:

<ns0:MT_Data_In xmlns:ns0="http://project.client.com">

    <DetailRec>

           <Field1>val1</Field1>

           <FieldN>valN</FieldN>

     </DetailRec>

     <DetailRec>

......

     </DetailRec>

     <TrailerRec>

           <FieldA>valA</FieldA>

     </TrailerRec>

</ns0:MT_Data_In>

Content Conversion Parameter in the Receiver Channel

Recordset Structure: DetailRec,TrailerRec

DetailRec.fieldFixedLengths

DetailRec.endSeparator

TrailerRec.fieldFixedLengths

TrailerRec.endSeparator

It works well when there are detail and trail records in the message.

When there are no Detail Records, there will not be any trailer records either. This is done in message mapping.

The Message would like this:

<ns0:MT_Data_In xmlns:ns0="http://project.client.com"></ns0:MT_Data_In>

In such a case, I'm supposed to write an empty output file (size 0). I've set the "Empty-message handling" to "Write Empty File" in the file receiver channel. Yet, I'm seeing the following error in the channel monitor:

Could not process due to error: java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'Conversion configuration error: Unknown structure '' found in document', probably configuration error in file adapter (XML parser error)'

Any help in resolving this issue is greatly appreciated! Thank you very much!!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

>>The Message would like this:

>><ns0:MT_Data_In xmlns:ns0="http://project.client.com"></ns0:MT_Data_In>

Ur message is exactly not empty so what u can do is create one java mapping which will check if the detailsRec nodes are present or not and if in case it's not there then create empty (blank) output in the mapping....and then i think empty message handling will work and u can create empty file on ftp/NFS server

refer this thread:

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

Thanks

Amit Srivastava

Former Member
0 Kudos

Hello,

if you use graphical mapping, you can use map with default function, your empty message become

<ns0:MT_Data_In xmlns:ns0="http://project.client.com">

    <DetailRec>

           <Field1>val1</Field1>

           <FieldN>valN</FieldN>

     </DetailRec>

</ns0:MT_Data_In>

Regards,

Guislain

former_member201264
Active Contributor
0 Kudos

Hi Lad,

I aggree with Guislan, but more things check here as belwo mapping.

Regards,

Sreeni.

Former Member
0 Kudos

Hi Amit, thank you for your response! When I used a java mapping class after the message mapping step in the operation mapping, to scan for recordsets under root node and remove even the root node when there is no recordset, I get the following error in the channel monitor:

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.'

When I view the transformed content in the IE monitor, I see

Invalid at the top level of the document. Error processing resource 'file:///C:/Users/czlad/AppData/Local/Temp/18158010_55...

When I view the temp file in Notepad++, I only see a "NUL".

This message makes sense, since the java mapping has removed the xml content.

So, Am I missing anything? Why the channel is throwing the SAX Parse exception? How to suppress it to get the empty file?

Thanks again!

Former Member
0 Kudos

Hi Guislain & Kancham, the intent is to create an empty file (size 0 bytes) when there is no recordset in the XML.

Answers (2)

Answers (2)

Former Member
0 Kudos

I just found that in this installation of PI 7.3, the content conversion is failing when there is more than one recordset structures - DetailRec and TrailerRec in this case. If there is only one recordset structure, then the content conversion works and creates a empty file if there is no data. I couldn't find a note to resolve this issue. So, I've worked around it to send the message to 2 different interfaces - one with a channel with FCC to process message with recordsets and other with a channel with FCC (that uses only one recordset) to process message with no recordset.

nabendu_sen
Active Contributor
0 Kudos

Hi,

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.

Please go to SXMB_MONI and open the Inbound Payload. There you should see any extra unwanted character.

Former Member
0 Kudos

Hi Nabendu, please refer my previous post:

When I view the transformed content in the IE monitor, I see

Invalid at the top level of the document. Error processing resource 'file:///C:/Users/czlad/AppData/Local/Temp/18158010_55...

This message makes sense, since the java mapping has removed the xml from the payload

When I view the temp file in Notepad++, I only see a "NUL".

nabendu_sen
Active Contributor
0 Kudos

Hi,

This means when Java Mapping is expecting a xml data with proper xml notations, its only getting "NUL" as you mentioned you can see with Textpad/notepad. Mapping is failing because Parser (SAX is a XML parser) is thinking that "NUL" is there before <?xml….”, but actually nothing is present. You need to discuss with the Sender System persons to why they are sending this.

In IE also, its showing this because not able to process XML data.