cancel
Showing results for 
Search instead for 
Did you mean: 

Skip first line of an XML- PI 7.0

former_member223432
Participant
0 Kudos

Hi Experts,

I am working on SAP PI 7.0 and File to Proxy scenario.

I need to read a XML file and send to ECC via Proxy..everytime it is failing in mapping because it has "UTF-16" in it as shown below.

<?xml version="1.0" encoding="utf-16"?>

this is not supported and hence i need to either change it to UTF-8 or remove this first line of an XML while reading from FTP only then it works.

Can someone please help me in doing this.

No FCC here..it is a plain XML file.

Thanks

Accepted Solutions (0)

Answers (4)

Answers (4)

stefan_grube
Active Contributor
0 Kudos

It seems that your XML file is not valid UTF-16. Could you try to open the file with internet explorer?

Do you see chinese letters in it, like 㰊 (3c0a)?

First you should assure that the file is valid, then you should compare the file before and after send by ftp, it might change.

RaghuVamseedhar
Active Contributor
0 Kudos

Smith,

Encoding can be changed using below options.

Option 1: - You can use modules to change encoding.

Work with character encoding in SAP PI. Section 4, page 5.

Option 2: - XSLT mapping.

Option 3: - Java mapping.

former_member181985
Active Contributor
0 Kudos

Hi Smith,

Try with XMLAnonymizer bean in sender File channel

anonymizer.encoding              UTF-8

Adding XMLAnonymizerBean in the Module Processor - Adding Modules to the Module Processor - SAP Libr...

Regards,

Praveen Gujjeti

former_member223432
Participant
0 Kudos

Hi Praveen,

I tried with module bean..but it still failing..PFA the screenshots.

2015-03-12 01:50:49SuccessChannel CC_FILE_XXX: Send binary file  "/Itest.xml". Size 2083 with QoS EO
2015-03-12 01:50:49SuccessAnonimizer: anonymizing XML ...
2015-03-12 01:50:49SuccessAnonimizer: failed to anonymized due to java.io.IOException: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 3c0a, 6e49, 6576(:main:, row:2, col:5)(:main:, row=2, col=5) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 3c0a, 6e49, 6576(:main:, row:2, col:5)
2015-03-12 01:50:49SuccessApplication attempting to send an XI message asynchronously using connection File_http://sap.com/xi/XI/System.
2015-03-12 01:50:49SuccessTrying to put the message into the send queue.
2015-03-12 01:50:49SuccessMessage successfully put into the queue.



<Trace level="1" type="T">com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) 3c0a, 6e49, 6576(:main:, row:2, col:5) at com.sap.aii.mappingtool.tf3.Transformer.checkParserException(Transformer.java:187) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:151) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:118) at com.sap.aii.ibrun.server.mapping.JavaMapping.executeStep(JavaMapping.java:64) at com.sap.aii.ibrun.server.mapping.Mapping.execute(Mapping.java:92) at com.sap.aii.ibrun.server.mapping.MappingHandler.run(MappingHandler.java:90) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleMappingRequest(MappingRequestHandler.java:95) at com.sap.aii.ibrun.sbeans.mapping.MappingRequestHandler.handleRequest(MappingRequestHandler.java:68) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceImpl.processFunction(MappingServiceImpl.java:79) at com.sap.aii.ibrun.sbeans.mapping.MappingServiceObjectImpl0_0.processFunction(MappingServiceObjectImpl0_0.java:131) at sun.reflect.GeneratedMethodAccessor337.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62) at java.lang.reflect.Method.invoke(Method.java:391) at com.sap.engine.services.ejb.session.stateless_sp5.ObjectStubProxyImpl.invoke(ObjectStubProxyImpl.java:187) at $Proxy204.processFunction(Unknown Source) at sun.reflect.GeneratedMethodAccessor336.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:62) at java.lang.reflect.Method.invoke(Method.java:391) at

former_member182412
Active Contributor
0 Kudos

Hi Smith,

Check the below SAP Note.

821267 - FAQ: XI 3.0 / PI 7.0 / PI 7.1 / PI 7.3 File Adapter

  • Q: How do I correctly configure the File Encoding used by the File Adapter?
  • A: Generally, the message payload of an XI message is treated as UTF-8 when it needs to be converted from or into a different encoding. So, what you specify in the File Sender channel is the source encoding for an encoding conversion to UTF-8. On the other hand, in the Receiver channel, you specify the target encoding for a conversion from UTF-8. If you configure a channel's File Type setting as "Binary", no conversion will be applied.

    Depending on your scenario, only some encoding settings actually make sense and lead to the expected results:
    • XML Files
      An XML file's encoding is set in the XML header, which is later interpreted when parsing the XML, e.g. in the mapping, so there is no necessity to perform an encoding conversion in the File Adapter. As a rule of thumb, always configure the File Type parameter of a sender or receiver channel as "Binary" when reading or writing XML data.
      Important: Even if you configure a File Encoding in the File Adapter channel, the File Adapter will not re-write the XML header to reflect the changed encoding, so you will probably see an XML parsing error later during the processing of the message if you specify an encoding.
    • Flat Files with File Content Conversion
      For a File Sender channel, configure the encoding of the source file. The file will be interpreted according to the configured encoding and converted to XML with an UTF-8 encoding.
      For a File Receiver channel, configure the encoding to match the encoding you would like to be written to the target flat file.
    • Flat Files without File Content Conversion
      Whether to configure an encoding in this case depends on if you want to pass through the file "as is", e.g. within a File Sender to File Receiver scenario, or if you want to convert the file's encoding on its way through the Integration Server. For "as is" processing, configure both the sender and the receiver using the File Type setting "Binary".
      To apply an encoding conversion, configure the respective source and target encoding in both the sender and receiver channel.
      Important: Configuring an encoding in the receiver channel will only lead to the expected results if the payload sent to the receiver channel is in UTF-8 format (e.g., by having specified an encoding conversion in the Sender channel).

Regards,

Praveen.

former_member223432
Participant
0 Kudos

Hi praveen,

I have already set File Processing parameter as "Binary". even then it is not working.

Any other valuable suggestions please

former_member182412
Active Contributor