cancel
Showing results for 
Search instead for 
Did you mean: 

Get xml output from command template in Javascript

Former Member
0 Kudos

Hi experts,

In transaction A I defined a transaction output property (xmloutput) as XML type then use xquery and icommand to wrap it in the applet. I am wondering if I can retrieve it in javascript and pass it to the transaction B which has a XML input property (xmlinput)? I am planing to pass structured data between transaction in this way.

Thanks,

Tony.

Accepted Solutions (0)

Answers (1)

Answers (1)

jcgood25
Active Contributor
0 Kudos

Tony,

Upon receipt of the query results, the iCommand will have the dataset available to you in JavaScript (see the methods in the Script Assistant), but it will not be a single xml object like the transaction would output. To bring back the whole dataset from TRX A to the client side and then pass it back down to TRX B seems a bit strange - what do you intend to do with the dataset on the client side with JavaScript?

Have you looked at the Transaction Action block, which allows you to call one transaction from another?

Regards,

Jeremy

Former Member
0 Kudos

Hi Jeremy,

I need to explain a little bit more about the background. The TRX A consists of bunch of complicated and time consuming SQLs which I intend to run only one time. The dataset returned by TRX A will feed to TRX B & TRX C and both of them will be executed several times according to different input from screen. In a nutshell, what I want is a memory hold the result of TRX A. So I am planning to do it in JAVASCRIPT. If I use call transaction action block in TRX B, the TRX A will be called as many times as TRX B is, which is not fine.

Thanks,

Tony.

Former Member
0 Kudos

Jeremy/Tony:

If you want to do it client side, an AJAX/HTTP POST approach would probably work best (particularly if the XML to be passed back and forth is of any significant size). Using the XmlHttpRequest object in your browser, you can invoke the BLS transaction(s) as needed (Google for examples of using XmlHttpRequest to issue "POST" requests, which you'll want to do in this case).

Rick

Former Member
0 Kudos

Rick,

Thanks for the input, now I am trying to convert xml to string in the TRX A, get this string in the javascript, pass it to the TRX B and then convert it back to xml via string to XML parser action. If it doesn't work I will go back to you for the detail. Thanks in advance.

Regards,

Tony.

Former Member
0 Kudos

Hi, Tony.

Just be sure you are on an up-to-date version of MII, as there were bugs in the XML parser action in earlier versions of 11.5. You might also be able to simply define the transaction parameter as an XML type, and the parsing/conversion might occur properly automatically. Also, there is a URL parameter named "InputParameter" that you should read about in the help. It allows you to use HTTP POST to send large content as an input to a BLS transaction via the Runner servlet.

Best regards,

Rick

Former Member
0 Kudos

You could store the data on a Queue using the Queue actions and then only have to pass the message ID around.