Script Adapter

The Script adapter enables Sterling B2B Integrator to run scripts that are written in various languages that use the Bean Scripting Framework (BSF).

The following table provides an overview of the Script adapter:

Category Description
System name BSF
Graphical Process Modeler (GPM) category All Services
Description Enables Sterling B2B Integrator to execute scripts written in various languages that utilize the Bean Scripting Framework (BSF), such as Jython and JPython. For more information about the Bean Scripting Framework and supported languages, see
Business usage Executes a script written in a language supported by the Bean Scripting Framework. If a customer has in-house expertise in one of the supported script languages, this adapter can be used to quickly solve the business need without having to write a new adapter.
Usage example A customer already has scripts in place to perform some processing task and wants to incorporate that into a business process. As long as the script is written in a language that is supported by the Bean Scripting Framework, then it can be easily incorporated using this adapter.
Preconfigured? No
Requires third-party files? At a minimum, the BSF classes (bsf.jar) are required, plus any and all script language classes (for example, jython.jar, bsh.jar). For more information about jython.jar, see For more information about bsf.jar, see
Platform availability All supported Sterling B2B Integrator platforms
Related services No
Application requirements No
Initiates business processes? Can be performed but is up to the individual script writer.
Invocation Runs as part of a business process.
Business process context considerations No
Returned status values The script can set the returned status, therefore the individual script writer determines what status is set. The only exception is when the script runs and no status is set; in this case the adapter returns a status of Success.
Restrictions This adapter has been tested with Python only. Scripts written in other supported languages may work, but be certain that the language comes with the necessary classes and that you have access to its documentation.

How the Script Adapter Works

The Script adapter gives users a way to incorporate scripts into Sterling B2B Integrator business processes without having to write a new adapter to handle the business need.

The Script adapter executes scripts written in languages supported by the Bean Scripting Framework. The Script adapter provides tight coupling between BSF user scripts and Sterling B2B Integrator by allowing scripts to access java objects that are normally only available to Sterling B2B Integrator adapters, thus providing a solution to complex business problems.


Your company uses a Python script to generate midday inventory reports from a legacy tracking system residing on a mainframe. Sterling B2B Integrator runs under UNIX, receiving and processing incoming orders and producing midday order reports. Rather than using two systems to produce the midday status reports, you use the Script adapter to import inventory data into the order reporting business process, allowing for easier tracking of orders against existing inventory.

Business Process Example

The following example uses the Script adapter:

<process name = "BSF"> 
  <operation name="Script Adapter">
   <participant name="ScriptAdapter"/>
   <output message="ScriptAdapterInputMessage">
     <assign to="scriptFileName">/somepath/</assign>
     <assign to="." from="*"></assign>
    <input message="inmsg">
     <assign to="." from="*"></assign>

Script Adapter Restrictions

The only scripts this adapter can execute have to be supported by the Bean Scripting Framework. If and when new script languages develop script engines that work with the Bean Scripting Framework, no code changes need to occur in the adapter code, as new script languages can be registered and used at any time.

Note: Most of this technology is open source, which brings with it certain caveats. Refer to the appropriate open source site for support.

Third-Party Adapters

For some adapters used with third-party software, you must install specific .jar files or drivers before you can use the adapter with Sterling B2B Integrator. These third-party .jar files are available from the applicable third-party software vendors. Often, you can download the files from the vendor's Web site. If an adapter requires any third-party files, the specific information about the files is included in the documentation for that adapter.

To install a third-party .jar file:
  1. Copy the .jar file to a directory on the host computer where Sterling B2B Integrator is installed. Record the path and name of the directory.
  2. Shut down Sterling B2B Integrator if it is running.
  3. Install the .jar file by running the install3rdParty script located in the installdir/bin directory. You can access the following instructions for using the command by typing in “install3rdParty” at the command line:
    Usage:  ./ vendorName vendorVersion 
                     <-j | -l | -p | -r | -d > filelist [-nodeploy]
    -j for jar/zip files
    -l for shared libraries
    -p for properties files
    -r for resource properties files
    -d for database jar/zip files
    ./ ibm_sap 3_5 -j /usr/local/lib/sap/*.jar
    ./ ibm_sap 3_5 -j /usr/local/lib/sap/infobus.jar
    ./ oracle  1_2 -d /usr/local/lib/jar/*.jar
    ./ oracle  1_2 -d /usr/local/lib/jar/
    ./ ibm_sap 3_5 -j /usr/local/lib/sap/infobus.jar
    ./ ibm_sap 3_5 -l /usr/local/lib/sap/*.so
    ./ ibm_sap 3_5 -l /usr/local/lib/sap/
    ./ ibm_sap 3_5 -p /usr/local/lib/sap/*.properties
    ./ ibm_sap 3_5 -p /usr/local/lib/sap/
    ./ mqseris 2_0 -r /usr/local/lib/mqs/
  4. Restart Sterling B2B Integrator. You can now use this adapter in Sterling B2B Integrator.

Implementing the Script Adapter

To implement the Script adapter, complete the following tasks:
  1. Write a script in a language supported by the Bean Scripting Framework.
  2. Configure the predefined Script adapter, or create a new Script adapter configuration. For information, see Managing Services and Adapters.
  3. Configure the Script adapter. For information, see Configuring the Script Adapter.
  4. Test the Script adapter configuration. For information, see Testing the Script Adapter Configuration.
  5. Use the Script adapter in a business process.

Configuring the Script Adapter

To configure the Script adapter, you must specify settings for the following fields in the GPM:

Field Description
Script Filename (scriptFileName) Fully qualified path and filename of the script to execute. Required.
Script Language Name (langName) Name of the script language (for example, Python). Optional — only required if not already included within Bean Scripting Framework (BSF).
Script Engine Class (engineClass) The name of the script engine class (for example, org.apache.bsf.engines.jpython.JPythonEngine). Optional – only required if not already included within BSF.
Script Language Extension (langExt) The extension used to associate with this language (for example: py, pl, or bsh). Optional — only required if not already included within BSF.

Objects Exposed for Use By a Script (Object Name – Class Exposed)

The following objects are available for a script to use:
  • siWfc – WorkFlowContext
  • siIwf – InitialWorkFlowContext
  • siWfd – WorkFlowDef
  • siRmi – BSFServer (the “little-a” RMI class for doing I/O)
  • siDoc – Document
  • siLog - XLogger

Testing the Script Adapter Configuration

After you have a script written that you want to test, create an instance of the Script adapter and create a business process that runs that instance.

Python Script Example

The following example ( illustrates a script written in Python:

# This script expects an input file with the workflow context 
# This script expects a bp called zze (FS Extract) to exist 
siDoc = siWfc.getPrimaryDocument(); 
name = siDoc.getBodyName(); 
body = siDoc.getBody(); 
stuff = siRmi.readFile("/home/test.txt"); 
id1 = siWfd.getIDForName("zze"); 
siWfk = siIwf.start(); 
id2 = siWfk.getWorkFlowId(); 
siDoc = siWfc.createDocument(); 
siDoc.setBody("this is a test"); 
siWfc.setWFContent("TestVal", "Hello"); 
siWfc.setWFStatusRpt("Status_Report", "hello");