cancel
Showing results for 
Search instead for 
Did you mean: 

PI Varbinary to JPG using Java Mapping

Former Member
0 Kudos

Hello

I have created an integration that takes a varbinary from a SQL database and uses a Java Mapping to convert it to output as a JPG. 

The Java Mapping works fine when I test it in eclipse, but when I use PI the image file comes out empty.  My problem comes when I try to create the PI operational mapping.  Because the JDBC adapter returns the following structure..

...into my Source and I need the output to be an image without any of the xml so I just have a one line...

before I run the JAVA mapping I perform a standard message mapping to move the varbinary into a simpler structure that can be easily process in the JAVA mapping without having to code it up to read all the xml and trim out the varbinary.

I then use the JAVA Mapping to convert the Varbinary string to an Image and put back into the...

structure, which is then output using the file adpater...here is my Operation Mapping...

I know that the JAVA Mapping works fine because if I create an integration that moves a varbinary cut and pasted into a text file using the file adapter and just use the Java Mapping between MT_Image_Out and MT_Image_In it works fine...

...its only when I have to get the varbinary from the JDBC xml structure to the image structure that I have a problem.

I know its a bit of a long question but any help would be appreciated.

Thanks

Matt

View Entire Topic
anupam_ghosh2
Active Contributor
0 Kudos

Hi Matthew,

                    Could you please explain why you need a message mapping prior to java mapping?

As java mapping can directly read and write binary image content. If you use a DOM parser it can directly reach a node to read its contents. Finally there may be problems when java mapping is trying to write the contents to the output directory. Are you using FCC in receiver side? or mapping is directly writing the contents to the output?

Regards

Anupam

http://wiki.sdn.sap.com/wiki/display/Snippets/Binary+Conversion+in+XI+-+Java+Mapping

Former Member
0 Kudos

Anupam

Thanks for the help, I had already considered doing it all in the mapping but as I am only just doing my first bit of Java thought I would try to cover some of the functionality off using a message mapping (which obviously doesn't work!)...anyway I have done it all in the java mapping now and it works good.

Thanks

Matt