Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 


In our daily business we have to handle different types of data-sources and data-sinks. Most of these data-source and data-sinks are UTF-8 aware already. But what if one of these is does not provide data in UTF-8 or does not understand it at all?

 

The PI/PO is only handling UTF-8-Data so how is it possible within the PI to convert the Encoding of a File/Message?

 

In one of our current scenarios we have to handle fixed-length files, which are read from a SFTP server.

(But this guide should also be valid for other scenarios)

 

The configuration is simple, but not obvious since the behaviour of the MessageTransformBean is a little bit strange :wink:

 

Here is what you have to do in the Module-Chain of your channel if you want to convert a message from a supported encoding into UTF-8.

 

Processing Sequence





































Number Module Name Type Module Key
1 AF_Modules/MessageTransformBean Local Enterprise Bean Codepage
2 AF_Modules/TextCodepageConversionBean Local Enterprise Bean Convert
3 AF_Modules/MessageTransformBean Local Enterprise Bean Transform
4 localejbs/CallSapAdapter Local Enterprise Bean entry

 

Module Configuration






























































Module Key Parameter Name Parameter Value
Codepage Transform.ContentType text/plain;charset=ISO-8859-1
Convert Conversion.charset utf-8
Transform Transform.Class com.sap.aii.messaging.adapter.Conversion
Transform xml.conversionType SimplePlain2XML
Transform xml.documentName Foo
Transform xml.documentNamespace http://example.com
Transform xml.fieldFixedLength 1,2,3
Transform xml.fieldNames ID, Bar, Baz
Transform xml.processFieldNames fromConfiguration
Transform xml.structureTitle Bar

 

The key in this configuration is to use two different instance of the MessageTransformBean. The first one only sets the codepage, and mime-type, which is then converted by the TextCodepageConversionBean. The sencond one parses the (now utf-8) text into xml.

 

These two steps are necessary since the class "com.sap.aii.messaging.adapter.Conversion" expects its data as utf-8 which is not right if the incomming codepage is not utf-8 but an other one.

10 Comments
Labels in this area