tag:blogger.com,1999:blog-34020393.post6598605072168521968..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: Serve JSON from PeopleSoftJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger26125tag:blogger.com,1999:blog-34020393.post-35349566972532366202017-03-25T09:08:47.118-07:002017-03-25T09:08:47.118-07:00@Sachin, I suggest posting to a server where you c...@Sachin, I suggest posting to a server where you can capture headers and data so you can verify everything is valid. The method demonstrated here will usually produce valid JSON, but not always. The JavaScript escape method does create valid JavaScript, but not necessarily valid JSON.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-33496223468148337262017-03-24T13:11:11.524-07:002017-03-24T13:11:11.524-07:00Hi Jim,
I tried your approach to post a JSON Mess...Hi Jim,<br /><br />I tried your approach to post a JSON Message from peoplesoft using non-rowset based message and GenJsonString() to generate a Json message and parse it with xmldoc.<br />However ,I am getting HTTP Status 415 error message <br />The server refused this request because the request entity is in a format not supported by the requested resource for the requested method<br />Apache Tomcat/7.0.59<br /><br />My requirement is to Post a transaction in JSON Format to Third party system (non peoplesoft) which has REST URI enabled to accept only POST methond.<br /><br />I am looking to do that in asynchronous way if possible but stuck at the error as above.<br />any advise you can offer what might be missing , We are in peopletools 8.53 <br /><br />also any reference you can provide for REST consumer services which i think is alternative to what i am doing above will also help <br /><br />Thanks for your help !<br />SachinSachin Jhawarhttps://www.blogger.com/profile/11021302759884148048noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-87227128668214544402015-09-23T09:07:52.002-07:002015-09-23T09:07:52.002-07:00@William, PeopleCode development took the "Do...@William, PeopleCode development took the "Documents" approach to JSON parsing. Instead of including a built-in parser, they require a Document object definition and then use the Documents API to parse JSON. Unfortunately, the Documents module supports limited structures. Besides the Java class option you mentioned, I have also used JSON.parse from JavaScript through the Java 7 Script Engine API that is included with PeopleTools.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-61860107412167203302015-09-22T12:48:09.400-07:002015-09-22T12:48:09.400-07:00Jim
Did you ever write the articular to use the ...Jim<br /><br /> Did you ever write the articular to use the ParseJsonString ... and transverse the structure similar to XMLDOC.<br /><br /> I am using JavaApPackage in 8.54 But for some reason you would think it should be In Peopelsoft by now.. Willhttps://www.blogger.com/profile/12798153440031730922noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-76382735983321130942015-06-15T18:07:10.621-07:002015-06-15T18:07:10.621-07:00I actually used your JSON java parser....
But si...I actually used your JSON java parser.... <br /><br />But since I was now in 8.54 and I saw ParseJsonString I thought it would be similar to parseXmlString ..<br /><br />Just create an blank XML Document and load it with a XML String.. That is great..<br /><br />I was hoping I would be able to try out something similar in the new version ..<br /><br />ANd your right... I am getting a JSon from an external source and it could change on a whim, I really want to have the control on what an how I read it.....<br /><br />I guess I will stick with the Java APPPackage <br /><br />Thanks<br />WillWillhttps://www.blogger.com/profile/12798153440031730922noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-65029855634401702862015-06-15T08:10:07.132-07:002015-06-15T08:10:07.132-07:00@William, this is one of the frustrations I have w...@William, this is one of the frustrations I have with parsing JSON with the Documents module: You need to create a Document with a structure that matches the JSON. This is easy if you are creating the JSON. Rarely do I find an optimized JSON file created by someone else that I can replicate with the Documents module. Instead, I choose to parse complex JSON using the Rhino JavaScript engine embedded in the Java version shipped with PeopleTools 8.53+. I should write a blog post on this. I have some examples I can share.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-18058156594692304892015-06-13T19:20:19.111-07:002015-06-13T19:20:19.111-07:00Jim
This should be an easy one for you ... In 8.5...Jim<br /><br />This should be an easy one for you ... In 8.54 I an getting a jSON file externally from a url and then I want to transverse the JSON that is returned..<br /><br />the ConnectorRequestUrl works great but the documentation in oracle is very limited on JSON<br /><br /><br />local document &DOC;<br />&json = %IntBroker.ConnectorRequestUrl(&Connection);<br /> <br />&Okay = &DOC.ParseJsonString(&json);<br /><br /><br />The Above gives me a NULL Error... Probably because &DOC is not instantiated <br />But how do I create a Blank Document to load...<br />I tried &DOC = Createdocument(" ");<br />What am I missingWillhttps://www.blogger.com/profile/12798153440031730922noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-56981145057851394832015-04-21T10:23:39.959-07:002015-04-21T10:23:39.959-07:00@Harry, Yes, you can generate JSON. Prior to Peopl...@Harry, Yes, you can generate JSON. Prior to PeopleTools 8.53, however, it was more difficult, requiring you to either use a Java JSON generator/parser or string text together using PeopleCode. I wrote a PeopleCode JSON escape routine that is available here: <a href="http://jjmpsj.blogspot.com/2010/04/json-encoding-in-peoplecode.html" rel="nofollow">JSON Encoding in PeopleCode</a>. You can find an example of using Java here: <a href="http://jjmpsj.blogspot.com/2008/09/parsing-json-with-peoplecode.html" rel="nofollow">Parsing JSON with PeopleCode</a>.<br /><br />If you are using PeopleTools 8.53 or higher, you can create a Document and then generate JSON from the document.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-80727997661131450902015-04-20T09:19:47.319-07:002015-04-20T09:19:47.319-07:00Hi Jim
I can able to genereate xml from peoplcode...Hi Jim<br /><br />I can able to genereate xml from peoplcode from the table data...Is it possible to generate Json in peoplecode ??<br />If so can you please share me some link or sample code...<br />Thanks for you helpharryhttps://www.blogger.com/profile/08388143845671284870noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-63400464536499930892013-08-22T20:53:28.024-07:002013-08-22T20:53:28.024-07:00@Narender, yes there is, but it is NOT recommended...@Narender, yes there is, but it is NOT recommended. To pass credentials in the URL, uncheck the requires authentication checkbox in the service, and then use a mechanism like the <a href="http://jjmpsj.blogspot.com/2011/10/rest-like-peoplesoft-services.html" rel="nofollow">one posted here</a> to parse the query string. With the credentials in variables, call <a href="http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcl/htm/tpcl02.htm#_6453b1b1_1355ab71343__bf" rel="nofollow">SwitchUser</a> to become the specified user.<br /><br />It really depends on how you are using the URL. If it is in your browser, the URL is quite visible, bookmarkable, available from history, etc.<br /><br />What is the reason you don't want to use Basic Auth HTTP Headers? I use REST with Ajax, and Ajax supports setting the authorization header for basic auth. In the <a href="http://api.jquery.com/jQuery.ajax/" rel="nofollow">jQuery.ajax</a> documentation you can see the username and password parameters.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-68167160241355360952013-08-22T17:28:29.078-07:002013-08-22T17:28:29.078-07:00Hello Jim,
I am trying to serve JSON through PS R...Hello Jim,<br /><br />I am trying to serve JSON through PS RESTFul service using a GET method.<br />When I try to invoke the URL from a browser, a window pops up for my UserID & Password.<br /><br />Is there a way that we can pass these credentials in the URL?<br /><br /><br />ThanksAnonymoushttps://www.blogger.com/profile/09665696614896643856noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-1755837073340539662012-02-22T21:42:03.352-08:002012-02-22T21:42:03.352-08:00@PS_Rookie, I don't have any experience with t...@PS_Rookie, I don't have any experience with the 360's, so, unfortunately, I can't give you any recommendations in that regard.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-60779273779976045892012-02-22T20:50:58.027-08:002012-02-22T20:50:58.027-08:00Hi jim, im trying to optimize de the 360 degree vi...Hi jim, im trying to optimize de the 360 degree view, i was tryimg to use ajax and jquery forthe tree , but know im stuck. <br />I was wondering how good an idea is to completly customize de 360, with ajxas abd jquery, using jqgrid and other plugins.PS_Rookiehttps://www.blogger.com/profile/16622810060101817596noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-63210490703430623822012-01-25T17:05:17.949-08:002012-01-25T17:05:17.949-08:00PS Swami, here is a good way to share your screens...PS Swami, here is a good way to share your screenshot: upload the image to some free file sharing site, and then use the a tag to link off to the image where you have it uploaded.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-53930960613558101652012-01-25T13:47:33.402-08:002012-01-25T13:47:33.402-08:00This comment has been removed by the author.PS Swamihttps://www.blogger.com/profile/18297310883698743385noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-44103374325579200082012-01-25T13:40:47.771-08:002012-01-25T13:40:47.771-08:00@PS Swami, when I paste that into jsonlint, I don&...@PS Swami, when I paste that into jsonlint, I don't get valid, I get invalid. The problem is the nested quotes. If I change it from "\nalert("blah");\n" to "\nalert('blah')'\n" then it works. From what I see in the comments, you have quotes inside quotes. That might not really be the case, but that is how it looks after the comment is posted.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-58348109770918372732012-01-25T13:35:34.853-08:002012-01-25T13:35:34.853-08:00[
{"appendTo": "BODY", "d...[<br />{"appendTo": "BODY", "data": "\nalert("This is a global script!");\n"}<br />, {"appendTo": "BODY", "data": "\nalert("This one is included in all components attached to menu DJMCUSTOM");\n"}<br />, {"appendTo": "BODY", "data": "\nalert("This is the search page!");\n"}<br />]<br /><br />Above is exactly what my page shows when I run the iscript with it set at text/javascript. When I paste that into jsonlint.com it says it is valid. The difference between your book and my output is the " vs "<br />When I change it back to application/json and run the iscript... I don't get the alerts. If I manually put an alert using straight javascript on an html object it works as expected.<br />I don't know if it is something I am causing or if it is correct and just not working. I can send you a screenshot if you think it would help.PS Swamihttps://www.blogger.com/profile/18297310883698743385noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-45074716845308636512012-01-25T13:04:56.086-08:002012-01-25T13:04:56.086-08:00@PS Swami, it sounds like you did everything right...@PS Swami, it sounds like you did everything right. We are definitely on different releases now, so that could account for some of it. JSON2.js shouldn't load since your browser has native JSON support. That is primarily for IE. Your comment mentions &quot but I don't see that in the post below. Was &quot in the contents of the book, but not in the firebug response? To which page are you referring?Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-23445636485406038312012-01-25T12:28:49.650-08:002012-01-25T12:28:49.650-08:00I am working through your book and have reached a ...I am working through your book and have reached a trouble spot in chapter 7 when JSON is introduced. I am able to get the JSON on the screen by calling the ISCRIPT as the book mentions. I paste the results into jsonlint.com and it says it is valid JSON. When I change the content type to application JSON and navigate to the web assets page... I don't receive the alerts as expected. However, I also don't see any errors in firebug. When I go into the firebug console for the get request... I can see the data under the JSON tab. The only difference I see between the book and my code is the appearance of the &quote vs ".<br /> {<br /> "appendTo": "BODY",<br /> "data": "\nalert("This is a global scr ipt!");\n"<br /> },<br />I am using the below tools:<br />Firefox 9.0.1<br />PeopleTools 8.51.07<br />jquery 1.7 min<br />JSON2.js but it doesn't load this<br /><br />Any suggestion would be appreciated.PS Swamihttps://www.blogger.com/profile/18297310883698743385noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-48636345242873914402011-08-11T07:42:11.174-07:002011-08-11T07:42:11.174-07:00@Ganesh, see my response to you in the post Going ...@Ganesh, see my response to you in the post <a href="http://jjmpsj.blogspot.com/2010/09/going-mobile-with-peoplesoft.html" rel="nofollow">Going Mobile with PeopleSoft</a>.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-69627437788428523702011-08-11T05:06:38.042-07:002011-08-11T05:06:38.042-07:00Jim,
1) how to send the JSON message create (in V...Jim,<br /><br />1) how to send the JSON message create (in Varaible or in file) to JSON server from Peoplesoft.<br />Use Java script or IScript - what is the request send HTTP Request or JSONRequest. Do we need to use IB, if yes how to publish the message ? <br /><br />When the user enter some message in peoplesoft page and submit it peoplesoft need to send the message to apple notification sever in JSON format (I know how the message should look like).<br /><br />It will be great if you have already create an applicaiton classs in peoplecode to create standard JSON message, similar to AddNode, Addattribute for XML message.Ganeshhttps://www.blogger.com/profile/05671330781617372189noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-87929503907133312162011-06-09T12:43:44.834-07:002011-06-09T12:43:44.834-07:00@SamTook, I think the difference is that I used js...@SamTook, I think the difference is that I used jsonlint to format what you see on the screen. For HTTP transfer, though, I recommend no spaces. A JSON parser doesn't need them, and they just add more bytes to the transfer.<br /><br />On another note... I was noticing that this post uses EscapeJavaScriptString, which will work most of the time, but not all the time. JSON has slightly different rules for encoded content. Rather than EscapeJavaScriptString, I suggest something like this:<br /><br /><a href="http://jjmpsj.blogspot.com/2010/04/json-encoding-in-peoplecode.html" rel="nofollow">JSON Encoding in PeopleCode</a>Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-79912311339152510132011-06-09T12:08:17.483-07:002011-06-09T12:08:17.483-07:00Calling the example you made, I noticed that it do...Calling the example you made, I noticed that it does not provide the carriage returns on the displayed page. Everything appears as one continuous (wrapped) line, but on your example it contains all the line feeds and indents. What's the difference in what you show and how PS is generating it when I test it?<br /><br />SteveSamTookhttps://www.blogger.com/profile/14545716068941284718noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-24296969781140597052009-03-29T12:43:00.000-07:002009-03-29T12:43:00.000-07:00I've released v0.5 of PL/JSON. Right now it can g...I've released v0.5 of PL/JSON. Right now it can generate JSON but not parse it. I'm working on parsing now.<BR/><BR/>I'm also adding documentation which is pretty sparse at the moment. I do include a detailed example script though.<BR/><BR/>Feedback would be great.<BR/><BR/>You can get it by reading the PL/JSON FAQ: http://oracleoss.com/<BR/><BR/>Thanks,<BR/><BR/>LewisCLewisChttps://www.blogger.com/profile/14652008216013571362noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-65527534494130897382009-03-25T07:06:00.000-07:002009-03-25T07:06:00.000-07:00@LewisC, very nice! I can't wait for the final!@LewisC, very nice! I can't wait for the final!Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.com