Call Bsh from simple method

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Call Bsh from simple method

HongNK
Hi I'm making a web service using simple method to display a list of pending orders. I wanted to reuse existing codes in OrderMgr application which do the same task. Therefore I will be using <call-bsh> to call this script
/order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh.

I'm facing 2 problems:

1. Tried to use "resource" attribute of "call-bsh". This attribute is documented to call external bsh scripts, but I do not know what is the URI format for the resource (no examples found). Besides the script is inside "WEB-INF" which might not be available to outside (I'm not sure about this)?

2. So I switched to inline code, as follows:
<call-bsh><![CDATA[
org.ofbiz.base.util.BshUtil.runBshAtLocation("component://order/webapp/ordermgr/WEB-INF/actions/order/orderlist.bsh",parameters); ]]> </call-bsh>

The script get called, but now the problem is that the Bsh script uses "request" object and "context" object. I realize "context" is actually "parameters" from the simple method, but where is "request", or how could I pass "request" object to external script to make it work without modification.

Thanks for your guide.
Hong