I have received a base64 encoded image from source system via REST post.
I need to convert this back to an image and write on the file system of the IS.
How do I generate back the image from a string of the based64 encoded image?
Any suggestions?
I have received a base64 encoded image from source system via REST post.
I need to convert this back to an image and write on the file system of the IS.
How do I generate back the image from a string of the based64 encoded image?
Any suggestions?
You can use “pub.string:base64Decode” service to convert inbound base64Encoded string to byte array and then you can use one of the below approaches:
OR
FileOutputStream fos = new FileOutputStream("pathname");
fos.write(myByteArray);
fos.close();
Hi Prasad,
I have gone with this approach suggested by you,
But when I open the tif image created in this way, it says it is not a valid image.
When I compare the base64 Encoded string which was initially sent by source system, and what was received by webMethods via Rest post, I see some addition ‘+’ signs added at the end of each line of the string.
Any comments, further advice?
Oh yeah… you may have to ask the sender/source to URL Encode the base64EncodedString (if webMethods, use pub.string:URLEncode) and as a first step of your target service URL decode the inbound string using pub.string:URLDecode
Hope this helps…