Skip to Content
0

Message Transformation Bean not converting csv to xml

Jun 19, 2017 at 09:19 AM

184

avatar image
Former Member

Hello,

I have to transform CSV to xml in SFTP adapter. Although we can use content conversion but it was not working so i used Message Transformation Bean. File is getting picked up but i am getting error in mapping.. since the file is not getting converted to xml.

Error message : com.sap.aii.utilxi.misc.api.BaseRuntimeException; Content is not allowed in prolog.,

Attached are screen shots for module used, can somebody please tell me where am i making mistake? Do i have to add/remove any parameters ?

Regards

Ankyy

structure.png (9.6 kB)
mtb-1.png (17.8 kB)
mtb-2.png (20.9 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Andrzej Filusz Jun 19, 2017 at 10:44 AM
0

Hi Ankyy,

Are you sure your XML is encoded in UTF-8? If yes, then please check if there are any characters before: <?xml

Probably you have a problem with the BOM (byte order mark) - please check if there is a sequence of bytes: EF BB BF at the beginning of your XML file.

Could you request a file without any additional characters at the beginning of your XML?

Regards,

Andrzej

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Andrzej,

Actually comma separated file from FTP is passing as it is into message mapping. Nothing is getting transformed into XML. So i am not sure.

Regards

Ankyy

0

Hi Ankyy,

Would you mind providing a Sample Data file which you are trying to pick.

Br,
Manoj

0
Former Member
Manoj K

Hi Manoj,

I have attached sample file. 1st line is the header line, rest are item lines. And i want convert it record wise(row wise).

Regards

Ankyy

sample.txt (672 B)
0
Manoj K Jun 19, 2017 at 04:23 PM
0

Hi Ankiy,

Please check below :

But note MTB dose't has a option of Removing of RecordSet hence the XML converted by MTB dosne'nt match with your current structure you either need to change your source structure or you need to remove this Recordset via java/xslt before passing it to your mapping.

Br,

Manoj


mtb.png (24.2 kB)
out.png (58.2 kB)
Show 5 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for the response Manoj... but somehow this is also not working.

0

Can you please share the screenshot of your MTB. and also for the file which it is throwing error.

0
Former Member
Manoj K

Attached is file & screenshot.

I have tried with field separator as nl.

But nothing is working.

sample.txt (672 B)
mtb-ftp.png (18.1 kB)
0

What's the error you are getting ?

0
Former Member
Manoj K

mapping error.. since file is not getting converted to xml.

Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; Content is not allowed in prolog., ApplicationRuntimeException: Runtime Exception when executing application mapping program

0
Evgeniy Kolmakov Jun 19, 2017 at 12:42 PM
0

Hi Ankyy!

Why did you set 'nl' as field separator when you have comma separated values in your source file?

Regards, Evgeniy.

Show 4 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Hi Evgeniy,

Since i want to send whole record line in single field, i have used field separator as 'nl'.

Regards

Ankyy

0

I guess that you have at least two fields in each of your recordsets: the key and the rest values.

Regards, Evgeniy.

0
Former Member
Evgeniy Kolmakov

Key field is not required, i have added it because i have used it in Message Transformation Bean.

Please check attached images for csv input and expected xml input

Let me know some way to transform above csv file.

Regards

Ankyy

0

Hi Ankyy!

May be my understanding is wrong, but since you have recordset with occurence "*" in your source file you should use keys for correct processing. Or you should set definite count for each recordset.

Regards, Evgeniy.

0
Evgeniy Kolmakov Jun 23, 2017 at 10:53 AM
0

Hi Ankyy!

You've missed the dot in parameter's name "Transform.Class".

One more question: do you need your header record in further XML processing?

Regards, Evgeniy.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Nice Catch.

1
avatar image
Former Member Jun 28, 2017 at 11:14 AM
0

Hello All,

I am closing this thread. Thank you for help.

Regards

Ankyy

Share
10 |10000 characters needed characters left characters exceeded