on 03-14-2016 2:27 AM
Hi,
I have a interface like below,
Third party sends base64(Encoding) data in XML(file name,File type and Data ) and i need to convert it to image in PI and send it to receiver system.
The receiver system expecting image and file name in output.
Can you please provide me some inputs on this.
Cheers,
Giri
Hi,
Below code is working for me but i am facing some issue on below points,
String f2e = new String(BASE64Decoder.decode(var1.getBytes()));
AbstractTrace trace = container.getTrace();
String location = "\\\\\\F\\ImageTesting\\Target";
String fileName = "test1.jpg";
byte image[] = BASE64Decoder.decode(var1.getBytes());
try {
OutputStream stream = new FileOutputStream(new File(location+fileName));
stream.write(image);
stream.close();
} catch (IOException e) {
trace.addWarning("Unable to write file :");
} finally{
trace.addWarning("File Written");
}
return "success";
1.Image should be created in the folder in the target path.
2.More images should be created with different names if there are more than one entries in the input payload.(if there are 2 entries in a payload and it should be like image _1 and image_2 in a folder)
Can you please provide me your inputs on the same.
Cheers,
Giri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkat,
You can use java mapping for your requirement. After converting the input stream (input payload) to string, extract the base64 data and decode using base64decode. Then write the output to output stream using the correct filename and extension.
Sample JAVA Mapping code using PI 7.1 API - Process Integration - SCN Wiki
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Giri,
This would be more appropriately handled in the manner Mark mentioned as you need to take the information and decode and then write the outputstream (payload). If you are working with UDFs then you are working with parts of an XML payload when you really need a binary stream as your output along with the dynamic configuration data. It's a pretty simple java mapping overall to achieve such a requirement.
Regards,
Ryan Crosby
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.