on 11-28-2012 2:57 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Hi Matthew,
Take the inbound XML from sxmb_moni and test it from operation/interface mapping. Check my blog: http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/07/08/can-we-test-binary-files-in-inter...
Regards,
Praveen Gujjeti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
One other thing that I notice looking at your Operational Mapping is that there seems to be a mismatch between the output of the 1st Message Mapping and the input of the 2nd Message Mapping. It appears that it works correctly when you run the java mapping solely with the XML structure for the 2nd mapping so maybe the disconnect is there? I'm curious to see the java mapping code on how you get the binary data and map it to the outputstream. See the two images below:
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ryan
I think you are right and the fact that to do it the way I wanted meant I had to have a mismatch between the output of the 1st Message Mapping and the input of the 2nd Message Mapping means that it was never going to work.
I have done it all in the java mapping now so have removed the need ofr the message mapping.
Thanks
Matt
Hi Matt,
The first thing I would do is check the output of your operation mapping in test mode. If that works as expected then there is a mismatch between the XML passed back from the JDBC and the message type declared in the message mapping. The reason I mention that is I noticed you don't have the "_response" in your message type for the input to your operation mapping. Maybe the JDBC piece in your scenario differs but it's something to check.
Regards,
Ryan Crosby
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get ...
16:26:21 Start of test
Loaded class com.sap.xi.tf._MM_ImageBLOBtoJPG_ |
Loaded class com.sap.xi.tf._MM_ImageBLOBtoJPG_$MT$InnerLibsList |
Loaded class com.sap.xi.tf._MM_ImageBLOBtoJPG_$MT$InnerParamsList |
Call method execute of the application Java mapping com.sap.xi.tf._MM_ImageBLOBtoJPG_ |
Java mapping com/sap/xi/tf/_MM_ImageBLOBtoJPG_ completed. (executeStep() of com.sap.xi.tf._MM_ImageBLOBtoJPG_). |
Loaded class MapImage |
Call method execute of the application Java mapping MapImage |
Java mapping MapImage completed. (executeStep() of MapImage). |
Execution of mapping on server took 156 milliseconds
Executed successfully
But also get...
Unable to display tree view; Error when parsing an XML document (Premature end of file.)
But I get this message when testing the version of the interface that works so think its just because I am outputting xml without any elements.
Matt
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.