cancel
Showing results for 
Search instead for 
Did you mean: 

problems with MessageTransformBean SimpleXML2Plain (XML to CSV) in receiver SFTP adapter

Former Member
0 Kudos

Hi PI experts,

I am trying to convert an XML file to CSV using AF_Modules/MessageTransformBean  module key XML2Plain in the SFTP receiver Communication channel

My Structure is like this :

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

<ns0:MT_PerfMan_File_Pics xmlns:ns0="urn:******.com:abc:1.0">

<Header>

  <UserId>UserId</UserId>

  <Photo>photo</Photo>

</Header>

<Item>

  <UserId>00000482</UserId>

  <Photo>SiN.jpg</Photo>

</Item>

<Item>

  <UserId>00000520</UserId>

  <Photo>AnJ.jpg</Photo>

</Item>

<Item>

  <UserId>00000563</UserId>

  <Photo>SCh.jpg</Photo>

</Item>

<Parameter>

  <Date>20141016</Date>

</Parameter>

</ns0:MT_PerfMan_File_Pics>

I checked the http://help.sap.com/saphelp_nw04/helpdata/en/24/4cad3baabd4737bab64d0201bc0c6c/content.html   and this link doen't work

I tried few blogs and referred Converting XML in the Receiver File/FTP Adapter to Text Format - Configuring the File/FTP Adapter in...  i still see the below error in Monitoring

Transform: Transformer Conversion3.0.5226 Error initializing Class: java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: (4408)
Parameter xml.fieldFixedLengths or xml.fieldSeparator is missing (4409)
Parameter xml.addHeaderLine is missing (4403)
Invalid addHeaderLine value null found (4407)
; caused by java.lang.Exception: java.lang.Exception: java.lang.Exception: Error(s) in XML conversion parameters found: (4408)
Parameter xml.fieldFixedLengths or xml.fieldSeparator is missing (4409)
Parameter xml.addHeaderLine is missing (4403)
Invalid addHeaderLine value null found (4407)

attached the screenshot of paramaters configured in CC

PI version : PO 7.31 single stack

Please help.

Best regards,

Varalakshmi SB .

Accepted Solutions (0)

Answers (3)

Answers (3)

suman_saha
Contributor
0 Kudos

Hi,

You may have written xml.recordsetStructure       Header,1,Item,*,Parameter,*

You should use xml.recordsetStructure          Header,Item,Parameter

engswee
Active Contributor
0 Kudos

Hi Varalakshmi

You are having multiple types of records - Header, Item, Parameter. You should be using conversion type StructXML2Plain instead.

Each of the record type should have its corresponding value for xml.<StructureName>.fieldFixedLengths.

You can refer to my blog below for a reference of valid parameters for MTB module.

FCC parameter reference for MessageTransformBean module

Rgds

Eng Swee

Former Member
0 Kudos

Hi

You should have parameter  "xml.addHeaderLine" in screenshot i can see u gave wrong "xml.Header.addHeaderLine"

Check this link for help on configuring parameters

How To...Content conversion module with J2EE JMS adapter - Process Integration - SCN Wiki

Regards

Osman

Former Member
0 Kudos

HI Osman , Eng ,

Thank you for your input and information of the links

I added

xml.addHeaderLine

xml.Parameter.fieldFixedLengths =8 without qoutes .Earlier as per normal FCC the channel had xml.Parameter.fieldFixedLengths =0 .

Now i dont get any error of Messagetransformbean paramter but I now error stating :

10/17/2014 1:05:00.588 PMErrorMessage could not be forwarded
to the JCA adapter. Reason: javax.resource.ResourceException: The variable
substitution can not parse the message xml: Content is not allowed in
prolog.
10/17/2014 1:05:00.590 PMErrorMP:
exception caught with cause javax.resource.ResourceException:
javax.resource.ResourceException: The variable substitution can not parse the
message xml: Content is not allowed in prolog.
10/17/2014 1:05:00.592 PMErrorException
caught by adapter framework: javax.resource.ResourceException: The variable
substitution can not parse the message xml: Content is not allowed in
prolog.
10/17/2014 1:05:00.593 PMErrorTransmitting the message to
endpoint <local> using connection JDBC_http://sap.com/xi/XI/System failed,
due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException:
javax.resource.ResourceException: javax.resource.ResourceException: The variable
substitution can not parse the message xml: Content is not allowed in prolog

my payload in xml :

My Structure is like this :

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

<ns0:MT_PerfMan_File_Pics xmlns:ns0="urn:******.com:abc:1.0">

<Header>

  <UserId>UserId</UserId>

  <Photo>photo</Photo>

</Header>

<Item>

  <UserId>00000482</UserId>

  <Photo>SiN.jpg</Photo>

</Item>

<Item>

  <UserId>00000520</UserId>

  <Photo>AnJ.jpg</Photo>

</Item>

<Parameter>

  <Date>20141016</Date>

</Parameter>

</ns0:MT_PerfMan_File_Pics>

any idea where is it going wrong ? attached the messagetransformbeanparamter for reference.

Thanks,

Lakshmi

engswee
Active Contributor
0 Kudos

Hi Varalakshmi

The error you are getting is due to variable substitution. Since you are performing content conversion using MTB in the receiver channel, you cannot also use variable substitution to dynamically rename the file. Refer to my reply in the following thread for further explanation.


Transmitting the message to

endpoint <local> using connection JDBC_http://sap.com/xi/XI/System failed,

You mentioned that you receiver channel is SFTP, but the log shows that it is sending to a JDBC connection instead. You might want to check that out.

Lastly, your configuration for the MTB part is still incorrect. As I mentioned earlier, you need to use StructXML2Plain conversion type instead. And since your expected output is CSV, you do not need to use the xml.<StructureName>.fieldFixedLengths parameters at all.

Below is how your configuration should be for xml.* portion of the MTB module.

Parameter NameParameter Value
xml.conversionTypeStructXML2Plain
xml.recordsetStructureHeader,Item,Parameter
xml.Header.fieldSeparator,
xml.Item.fieldSeparator,
xml.Parameter.fieldSeparator,

It is as simple as that! The other parameters are not necessary - do refer to the reference in the blog I provided earlier to see which fields are required or not for the different scenarios.

Rgds

Eng Swee