Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 9 Using the OIG Rules Programming Interface : Utility Rules

Utility Rules
Accessing RPI Arguments
Object Integration Gateway provides the following utility rules to access argument data passed from the client web application.
value = ECTSGETARG(argname)
Returns the value of the parameter argname as passed from the client application. For example, the application could pass argname from a web browser via an HTTP POST or as part of the URL query string, or on a method call on the COM component. If argname is not found as a passed argument, the system looks for a session data value of the same name. Throws an ArgNotFound exception, if the parameter is not found.
value = ECTSRETURNARG(argname)
Same as ECTSGETARG, except that it returns an empty string if the parameter is not found.
Accessing Object Integration Gateway Session Parameters
Object Integration Gateway provides the following utility rules to access Gateway session parameters.
ECTSDELSESS(sessionparmname, sessionparmvalue)
Deletes the named value from both session context and the collection of variables provided to the Gateway for subsequent interactions.
value = ECTSGETSESS(sessionparmname)
Returns the value of the named Gateway session parameter.
ECTSREMSESS(sessionparmname, sessionparmvalue)
Deletes the named value from the collection of variables provided to the Gateway for subsequent interactions, but not session context.
ECTSSETONCE (sessionparmname, sessionparmvalue)
Sets the value of the named Gateway session parameter to the passed value such that it is placed in the web application’s SESSION context, but not in the collection of variables provided to the Gateway for subsequent interactions.
ECTSSETSESS(sessionparmname, sessionparmvalue)
Sets the value of the named Gateway session parameter to the passed value.
Messaging
You use the following rules to control Gateway messaging.
ECTSMSG(message)
Sets message text that is sent to the client by a rule. By default, the message is sent via a persistent data parameter (session data on a web server) called ECTSMSG.
Execution/Generation
You use the following rules to execute or generate Object Integration Gateway objects.
See also the TIBCO Object Service Broker Shareable Tools manual.
XMLPARSE(docname, validate, docsource, docdata)
Begins parsing an XML document.
XMLSTART(xmldocname, predicate, parm)
Generates an XML document based on the passed data access arguments.
XMLSTARTDSN(outdsn, predicate, parm)
Generates an XML document based on the passed data access arguments, and places it in the specified file.
XMLSTARTSETDEST(tablespec, fieldspec)
Sets up the output table and field for XMLSTART.
XMLSTARTTAB(tablename, format, predicate, parm)
Returns a table to the OIG client.
Formatting and Linking
The following rules can be useful when writing format and link rules.
value = $TRANXMLSTRING(string)
For use with XML document format rules. Translates the given string into a format that is XML parser-safe, and returns it. For example, the string “x<y>z” could be interpreted as a valid XML tag. Normally to prevent this the data is automatically converted by Object Integration Gateway to an XML-safe format. However, in a format rule it could be desirable to return additional XML data as part of the string. In this case it is up to the developer to ensure that the result is valid and safe.
value = $URLENCODE(string)
For use with link rules. Some special characters are not permissible in a query string because they have meaning as part of the URL syntax. This rule translates the given string to a URL-safe format that can be used as an argument, and returns it.
Selecting an Application Profile
You can use the following rule to select an application profile. You use application profiles, which are defined in the TIBCO Object Service Broker UI, to specify default settings for an application.
ECTSSETAPP(appname)
Selects the named application profile for use with the current application.
Making an HTTP Request
Use the following tool to make an HTTP request.
See also the TIBCO Object Service Broker Shareable Tools manual.
value = $HTTPREQUEST(requesttype, url, header, data, result, message)
The rule returns the HTTP response code as an integer value. The return value has type C, syntax B, and length 4. A response code of 1000 indicates a non-HTTP error.
The following illustration shows an example of how $HTTPREQUEST can be called in a rule:

 
GETTEST();
- LOCAL HTTPCODE, URL, HEADER, DATA, RESULT, MESSAGE;
_ --------------------------------------------------------------------------------
_ --------------------------------------------------------------------------+-----
_ URL = 'HTTP://WWW.TIBCO.COM/POSTTEST.ASP?P1=1&P2=AAA'; | 1
_ HTTPCODE = $HTTPREQUEST('GET', URL, HEADER, DATA, RESULT, MESSAGE); | 2
_ CALL ENDMSG('RC=' || HTTPCODE || ', M=' || MESSAGE || ', R=' || RESULT); | 3
_ |
-------------------------------------------------------------------------------

 
Logging
Use the following rule to write messages to the Object Integration Gateway log file.
ECTSLOG
Writes a message to the Gateway log file.

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved