loading
 
HTTP module, string variables, JSON parsing...
Carl W Ott from United States  [11 posts]
2 years
If one has used the JScript module to create a 6 KB or 8 KB string variable containing JSON data, is it possible to use the HTTP module to pass that to a web page?

Is it possible to POST to https URL?

And, can the HTTP module parse a response passed as a JSON?  The HTTP module appears able to parse & extract from responses sent as HTML/XML, but what about JSON?
Steven Gentner from United States  [1370 posts] 2 years
Carl,

You might be better of just doing that in JScript ... while the HTTP module can be used for this, if you are already comfortable with JScript that's probably much easier to just use its internal objects, i.e. something along the lines of JQuery. We've not tried to incorporate JQuery type libs into the module but that should be possible.

STeven.
Carl W Ott from United States  [11 posts] 2 years
STeven,

Thanks for the rapid feedback.  Reaching into internal and system objects are a little beyond my current ability.  But your advice clearly explains the architectural concept.  That makes perfect sense, and gives enough direction to dig in.  Sounds like it should be straightforward to look closer at libs like JQuery, and find some kind of call similar to the example you gave for writing to system files like with this example  
var fso = new ActiveXObject("Scripting.FileSystemObject");
var fi = fso.OpenTextFile("PlaceToSaveStuff.txt", 8, true);
fi.write( tmpStr );
fi.close();

BTW - would you recommend one language over another to make such calls from w/in RoboRealm?  I'd rather stretch language skills in a better/ more capable/ more scaleable direction versus a lesser language that I just happen to have barebones familiarity with - Especially if using such a language with RoboRealm would enable better integration with an IDE like IntelliJ IDEA or Eclipse...

Carl
Steven Gentner from United States  [1370 posts] 2 years
Carl,

I'd probably use the JScript module as that is uses MS's JScript object that comes with IE. Since that's really built to handle things like JSON that might be the best route. While the VBscript and JScript modules share the same based MS objects the JS one seems better suited for JSON.

The other possibility is to reverse the perspective. Have your external program make calls into RR that produce JSON variables. There is a webserver built into RR which could be used for that. If that route would make things easier let me know and we can work up a quick JSON example of getting variables from RR into JScript.

If you check the checkbox to have that file loaded instead of embedded into the module text area you can use an external editor like Eclipse to write that text. When you have, RR will reload and rerun that.

STeven.
Carl W Ott from United States  [11 posts] 2 years
STeven,

thanks.  Yes I thought about the perpective change, that's a nice option.  But in this case RoboRealm is easier for me than writing an external app/UI.

Thanks for the comparison on JScript vs VBscript, and for linking to Eclipse.

Carl

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index