tag:blogger.com,1999:blog-34020393.post3950778188140486001..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: Base64 Encoding Binary Files in PT 8.52Jim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-34020393.post-49436179975614836132018-05-24T13:27:19.299-07:002018-05-24T13:27:19.299-07:00Hi Jim,
I'm working on consuming a webserive ...Hi Jim,<br /><br />I'm working on consuming a webserive where the attachments in 3rd party system are sent in base 64 format in the response message. I receive a successful base 64 response when I make a call to the API from tools like Postman or RESTClient but I'm receiving an empty response when tried from Peoplesoft. Can you please help?<br /><br />ThanksAnonymoushttps://www.blogger.com/profile/17632234066416498845noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-92040665813813918662016-02-10T08:21:45.425-08:002016-02-10T08:21:45.425-08:00@prasad.poojari, there are a couple of ways. You c...@prasad.poojari, there are a couple of ways. You can use tables as targets for the File Attachment API. If your images are in a record that fits the format, you can use GetAttachment. If not, then you may need to use database support for exporting files (PL/SQL, etc).Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-11210821786302464152016-02-09T23:15:04.799-08:002016-02-09T23:15:04.799-08:00Hi Jim,
Hope you're doing great.
I am using ...Hi Jim,<br /><br />Hope you're doing great.<br /><br />I am using ftp to store file attachments on server, however now I need to store Image to Ftp server. I receive this image in binary format from 3rd party java application. Is there a way through which I can convert this binary image data stored in database to a file on some temporary location on the server. This file in temporary location then can be used to attachment functionality which is already existing. <br /><br />Thanks in advance.prasad.poojarihttps://www.blogger.com/profile/09725020487875622309noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-69265930460659087152014-07-28T11:30:27.460-07:002014-07-28T11:30:27.460-07:00@Mohd, there are a good 1/2 dozen ways to base64 e...@Mohd, there are a good 1/2 dozen ways to base64 encode data using PeopleTools. This blog post contains links to those other methods. For zip files, a couple of years ago I wrote the post <a href="http://jjmpsj.blogspot.com/2012/10/manipulating-zip-files-with-peoplecode.html" rel="nofollow">Manipulating Zip Files with PeopleCode</a>. If you are using PeopleTools 8.53, zip files are even easier with the Java ZipFileSystem, but the older method still works.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-70746073195266558552014-07-26T13:34:31.806-07:002014-07-26T13:34:31.806-07:00This comment has been removed by the author.MS Bloghttps://www.blogger.com/profile/06366269402728774375noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-87179274683727134972014-02-14T01:51:59.733-08:002014-02-14T01:51:59.733-08:00Hi Jim,
We wanted to access the SharePoint Porta...Hi Jim,<br /> We wanted to access the SharePoint Portal from PeopleSoft Asaikarthikhttps://www.blogger.com/profile/09839540716046113269noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-25349642279083502682013-11-07T07:13:23.966-08:002013-11-07T07:13:23.966-08:00Hi Jim,
Thanks for your very valuable help.
I fact...Hi Jim,<br />Thanks for your very valuable help.<br />I fact I was using a record to store a temp file doing:<br /> PutAttachement<br /> ViewAttachement<br /> DeleteAttachement<br />But it does not work may be due to the lantency with the browser as it gets deleted before it's opened in the browser ... any clue ?<br /><br />So finaly I tryed your proposal<br />and I'm doing:<br /> PutAttachement<br /> Then Call an Iscript where I use your method:<br /> %Response.WriteBinary(&data);<br /> and finally DeleteAttachement in the IScript<br /><br />So for now I'm happy that it works, but I wonder why it does not work with the full Attachement API.<br /><br />best regards,<br /><br />/Stéphane.<br />Anonymoushttps://www.blogger.com/profile/17217001878233338420noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-84842670197291016562013-11-06T07:54:55.830-08:002013-11-06T07:54:55.830-08:00@Stéphane, your %Response.Write would write the ba...@Stéphane, your %Response.Write would write the base64 content. You want the binary content. I was referring to <a href="http://jjmpsj.blogspot.com/2009/01/exporting-attachments-part-2.html" rel="nofollow">this</a> blog post. Notice that I select from a database table, not read from a file. That is because there is no way to get binary content from a file into a variable (there might be, I just haven't found it).Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-2971472673170772012013-11-06T06:57:09.923-08:002013-11-06T06:57:09.923-08:00Jim,
regarding the file:// topic, the idea was to ...Jim,<br />regarding the file:// topic, the idea was to use it with the ViewAttachement function, but I can't make it work on UNIX.<br /><br />/Stéphane.Anonymoushttps://www.blogger.com/profile/17217001878233338420noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-14517269443922575172013-11-06T06:54:52.283-08:002013-11-06T06:54:52.283-08:00Jim, In fact I tryed an IScript with this:
Loc...Jim, In fact I tryed an IScript with this:<br /><br /> Local File &F1;<br /> Local string &base64string;<br /> <br /> &F1 = GetFile(&filename, "R", %FilePath_Absolute);<br /> If &F1.IsOpen Then<br /> &base64string = &F1.GetBase64StringFromBinary();<br /> &F1.Close();<br /> End-If;<br /> <br /> %Response.Write(&base64string);<br /> <br /><br />but it does not work as the downloaded filesize is 80k instead of 100k ...<br /><br />Any idea ? I can't file solution in your books :)Anonymoushttps://www.blogger.com/profile/17217001878233338420noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-5931300289149121302013-11-05T09:51:30.176-08:002013-11-05T09:51:30.176-08:00@Stéphane, file:// is for reading local files and ...@Stéphane, file:// is for reading local files and is from the perspective of the browser. It won't transfer files between the server and the client. If you write the file into the HTTP path, then you can use http(s)://, but that may not be safe depending on data security. The safest way I know to transfer binary data from the server to the client is through an iScript with %Response.WriteBinary. The problem with this approach is that selecting binary from the database into a variable of type "Any" is the only way I know to get binary data into a variable.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-39345538531807651802013-11-05T07:23:11.401-08:002013-11-05T07:23:11.401-08:00Hi Jim,
I'm using WriteBase64StringToBinary to...Hi Jim,<br />I'm using WriteBase64StringToBinary to write a file on the App server, then I need to display it to the user with ViewAttachment.<br />is it possible to use "file://" instead of "ftp://" on Linux/PeopleTools 8.52 to get the file ?<br />Thanks.Anonymoushttps://www.blogger.com/profile/17217001878233338420noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-38332800319501575252013-09-25T07:20:57.517-07:002013-09-25T07:20:57.517-07:00Jim - This is a native app and I am using GET/POST...Jim - This is a native app and I am using GET/POST to send/receive data from it. Thanks for the suggestion, this is currently what I have in place. <br /><br />I've been looking into message segments because it appeared to possibly be more efficient but so far it has just appeared to be using everything we aren't. <br /><br />I will follow up on OTN and see if there are any suggestions there.<br /><br /><br />Thanks,<br />KyleKyle Windsorhttps://www.blogger.com/profile/11020717814174141586noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-21273534554836753332013-09-24T15:06:22.195-07:002013-09-24T15:06:22.195-07:00@Kyle, is this a web based app or a native app? Ar...@Kyle, is this a web based app or a native app? Are you using Canvas or file uploads or a native app with a REST service? I assume you are using PUT or POST? With Canvas or a native app, I recommend base64 encoding the file to upload (canvas supports this). Then you can place the base64 directly in your text-based payload. I am not sure how to handle this with a file upload, that is why I make the distinction.<br /><br />MTOM... I actually have no experience with MTOM yet. You might post the same question on the <a href="https://forums.oracle.com/community/developer/english/peoplesoft_enterprise/peoplesoft_general_discussion" rel="nofollow">OTN forum</a>Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-22842369127224635092013-09-24T10:43:51.493-07:002013-09-24T10:43:51.493-07:00Jim - I am working on an 8.52 peopletools system a...Jim - I am working on an 8.52 peopletools system and I am using integration broker to communicate with a mobile device. Up until now, all of the development has been with a REST Service. I now need to be able to recieve attachments from the mobile device that will primarily be images.<br /><br />My question is if it is possible to do this with a REST service using message segments/MTOM-encoded? I have been looking through peoplebooks and there seems to be an indication that it's possible, but REST services require the REST connectors and MTOM-encoding/message segments require either HTTP Connectors or PeopleSoftServices Connectors. <br /><br />Thanks in advance for any insight you can shed on this subject.<br /><br /><br />KyleKyle Windsorhttps://www.blogger.com/profile/11020717814174141586noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-7404680072451956412013-08-05T08:05:21.567-07:002013-08-05T08:05:21.567-07:00@John, thanks! Nicely done! Great use of the File....@John, thanks! Nicely done! Great use of the File.GetBase64FromBinary method.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-88686690183775198872013-08-05T05:00:51.516-07:002013-08-05T05:00:51.516-07:00Hey Jim: Here is a cool way to use the 8.52 functi...Hey Jim: Here is a cool way to use the 8.52 function GetBase64StringFromBinary(). We create a graphical calendar for students via a java program and the end result is always a jpeg that we display directly on a page. We have used several methods over the past few years, but I found a really cool way to display this without needing an iscript. Here is the gist:<br />Assuming you have your jpg in a file on the app server:<br /><br />Local File &imgFile = GetFile(&str_FileName, "R", "", %FilePath_Relative);<br /><br />DERIVED.HTMLAREA1 = "<... src=""data:image/jpeg;base64," | &imgFile.GetBase64StringFromBinary() | """/>";<br /><br />That's it! The image is base64 encoded and then the contents pushed directly to the browser.<br /><br />The issue I had with using an iscript was the image was dynamic and one-time, so if I deleted it from the database before the page loaded, the image was broken.<br /><br />Regards,<br />John John Neyhttps://www.blogger.com/profile/11862508208917663195noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-90050320096406331412012-10-08T16:26:30.907-07:002012-10-08T16:26:30.907-07:00@mymithraa, the blog comments editor does not allo...@mymithraa, the blog comments editor does not allow you to paste in XML directly, so it is difficult to see the issue here. I suggest that you post your question on the <a href="https://forums.oracle.com/forums/forum.jspa?forumID=432" rel="nofollow">OTN forum</a> or in <a href="peoplesoft.ittoolbox.com/groups/technical-functional/peopletools-l/" rel="nofollow">ITToolbox</a>.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-55293166579680183882012-10-08T06:27:52.820-07:002012-10-08T06:27:52.820-07:00Jim,
We got one scenario. In one of the integrati...Jim,<br /><br />We got one scenario. In one of the integration with third party using WSDL we are getting response with attachment. Below is the raw XML response (Using SOAPUI). We are not sure how to handle this RESPONSE in PS. Please share ur thoughts.<br /><br /><br />HTTP/1.1 200 OK<br />Date: Mon, 08 Oct 2012 06:46:54 GMT<br />Server: Apache<br />Cache-Control: no-store<br />Transfer-Encoding: chunked<br />Content-Type: multipart/related; type="text/xml"; boundary="uuid:b4ee8c4f-7749-4146-a0c8-42ac06e19046"<br /><br />--uuid:b4ee8c4f-7749-4146-a0c8-42ac06e19046<br />Content-Type: text/xml<br /><br /><br />--uuid:b4ee8c4f-7749-4146-a0c8-42ac06e19046<br />Content-Id:<br />Content-Type: application/octet-stream<br />Content-Transfer-Encoding: binary<br /><br />"Application Id","Template Id","Country","Job Code"<br />"241","262","","123"<br />"241","301","","123"<br />mymithraahttps://www.blogger.com/profile/01626105447509584050noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-6177316971929478842012-05-01T10:52:59.800-07:002012-05-01T10:52:59.800-07:00@Sri, PT 8.52 has some new methods that make Base6...@Sri, PT 8.52 has some new methods that make Base64 encoding easier, but the base64 encoding mechanisms used for 8.49 will continue to work in 8.52. For releases prior to 8.52, I recommend <a href="http://jjmpsj.blogspot.com/2010/01/base64-encoding-binary-files.html" rel="nofollow">this approach</a> which uses Java Objects to read binary files and convert them to base64 text. Once converted, you can insert them into XML messages. My Base64 Encoding Binary Files post uses the apache commons Base64InputStream because it is easier, but if you can't use 3rd party libraries, you can still accomplish this using delivered base64 encoding libraries. See the comments in <a href="http://jjmpsj.blogspot.com/2009/05/base64-encoding-for-peoplesoft.html" rel="nofollow">this post</a> for details.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-25269448012423274512012-05-01T10:09:14.146-07:002012-05-01T10:09:14.146-07:00HI, Can any one provide me inputs on the base64 en...HI, Can any one provide me inputs on the base64 encoding in peoplesoft. Our users upload the files online to FTP , we are encoding these files and sending to Filenet system.<br />Currently we are at 8.49 tools, we are going to move to 8.52 tools soon.<br />Will there be any difference for encoding for these versions.<br />Thanks.Srihttps://www.blogger.com/profile/15357618786467350124noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-35976784254334520422012-04-23T09:01:34.259-07:002012-04-23T09:01:34.259-07:00@doubleDog, right, if you are working with non-fil...@doubleDog, right, if you are working with non-file data, for example, strings, then, yes, you will still need to use one of the approaches described in my other blog posts. Your code is a good example. Besides the undocumented com.peoplesoft.tools.util.Base64 method, you may also want to look into the documented Pluggable Encryption method demonstrated in <a href="http://jjmpsj.blogspot.com/2009/05/base64-encoding-with-pluggable.html" rel="nofollow">this blog post</a>. The pluggable encryption route requires a bit more configuration, though.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-23738016072566754582012-04-18T11:08:53.580-07:002012-04-18T11:08:53.580-07:00What if you are needing to use Base64 dynamically,...What if you are needing to use Base64 dynamically, like as part of a web service? Leveraging some comments from your blog we came up with this, which is testable with the App Designer debugger:<br /> <br />Local string &myEncodedString, &plainTextXMLData, &myDecodedString;<br />Local JavaObject &EncodeDecode, &StringObj, &ByteObj;<br />Local boolean &bResult;<br /><br />&plainTextXMLData = "Input sample Text.";<br /><br />&EncodeDecode = CreateJavaObject("com.peoplesoft.tools.util.Base64");<br /><br />/*Encode*/<br />&ByteObj = CreateJavaObject("java.lang.String", &plainTextXMLData).getBytes();<br />&myEncodedString = &EncodeDecode.encode(&ByteObj);<br /><br />/* Decode*/<br />&StringObj = CreateJavaObject("java.lang.String", &EncodeDecode.decode(&myEncodedString));<br />&myDecodedString = &StringObj.toString();Alexhttps://www.blogger.com/profile/11857289053465045100noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-75639096362512919102012-04-11T11:00:44.607-07:002012-04-11T11:00:44.607-07:00@Russ, that is very good to know. I appreciate the...@Russ, that is very good to know. I appreciate the response. Cutting the run time in 1/2 is very impressive.<br /><br />How are you handling restart if it fails? Do you mark rows as processed so they won't be queried and reprocessed?<br /><br />I wonder if you could fine tune it even more by only calling CommitWork and CollectGarbage every 500 or 1,000 rows or so? This would cut down on disk writes and may reduce memory operations, but not sure about that one. Not sure if it is worth the effort to investigate.<br /><br />Just FYI, I've seen similar issues with Integration Broker and CI's. I suspect the same solution would help with IB memory issues as well.<br /><br />For other readers of these comments, you can view additional comments on <a href="https://forums.oracle.com/forums/thread.jspa?messageID=10269104" rel="nofollow">Russ's OTN thread</a>.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-1475604411833798042012-04-11T10:09:37.046-07:002012-04-11T10:09:37.046-07:00Jim - You are correct it doesn't work if you l...Jim - You are correct it doesn't work if you leave the CI instantiated. I solved my problem by throwing the kitchen sink at it. I added commitwork(), collectgarbage() and cancel after each row and it ran through them all no problem. Also it doubled the speed.<br /><br />Thanks,<br />RussRbop51https://www.blogger.com/profile/00734392843409152869noreply@blogger.com