In this section: |
How to: |
The Script object is available, which you can configure and add to process flows that are constructed in iIT. The Script object uses the following iSM service type:
com.iwaysoftware.service.ScriptAgent
The Script object allows you to include complex document processing and routing instructions in your process flow that are written in any scripting language that is supported by the Java Scripting API (for example, Jython). This enables your application to optimize some of the application processing into a script rather than a complex process flow. As a result, you can also reuse identical logic across multiple systems.
To add the Script object to a process flow, click and drag the Script object from the Execution Objects palette, as shown in the following image.
You can also add the Script object to a process flow from the New Object Wizard dialog, as shown in the following image.
You can also right-click anywhere in the workspace area and select Create Object from the context menu.
From the New Object Wizard dialog that opens, expand the Execution Objects category and select the Script object, as shown in the following image.
The New Script Object dialog opens, as shown in the following image.
The Object Properties pane opens, as shown in the following image.
Note: You can also click Next to enter pre-execution variables, post-execution variables, and set debug settings for this object if required.
The new Script object is added to the workspace area, as shown in the following image.
How to: |
This example shows how a process flow and service can be invoked using the Script object.
importPackage(com.ibi.edaqm); importPackage(com.iwaysoftware.iwscript); function execute() { var outDir = tools.getSpecialRegister("docOut"); params = tools.newParameters(); params.put("directory", outDir); // execute process processName = "hello_p1"; process = tools.getProcess(processName); processResponse = new XDDocument(); state = process.execute(ctx.getDocIn(), processResponse); if (state.indexOf('fail') == 0) { tools.info("Process flow '" + processName + "' not found"); } else { // write result of process to file params.put("pattern", "process.xml"); processToFile = tools.makeNewService("XDFileEmitAgent", params); processToFile.execute(processResponse, new XDDocument()); return "success"; } }
C:\Scripts\pflowobj.js
This process flow must contain a Start object, Script object, and an End object.
Verify that a response is obtained in the destination as defined by the new application.
How to: |
This example shows how an iWay Transform component can be invoked using the Script object.
importPackage(com.ibi.edaqm); importPackage(com.iwaysoftware.iwscript); function execute() { transformResult = new XDDocument(); transform = tools.getTransform("Computer_Parts_Sales"); status = transform.execute(ctx.getDocIn(), transformResult); return XDAgent.EX_SUCCESS; }
C:\Scripts\transformobj.js
This process flow must contain a Start object, Script object, and an End object.
<ism_home>\tools\transformer\samples\transform_projects\xml\XML_to_XML\Computer_Parts_Sales
<ism_home>\tools\transformer\samples\transform_projects\xml\XML_to_XML\Computer_Parts_Sales\input.xml
Verify that a response is obtained in the destination as defined by the new application.
|
iWay Software |