↓ Skip to main content
An ink and watercolour drawing of a wooden pigeonhole cabinet with twelve compartments in three rows on a workbench. Eleven compartments hold a rolled letter tied with teal string and a red seal, most with a blank name plate below. The compartment at the bottom right is empty. On the bench in front lies one rolled letter, its torn-off label beside it.

Integration Scripts: Every Exit and the Names Behind It

Maximo Automation Scripts - This article is part of a series.
Part 18: This Article
An integration script has no launch point. Manage finds it by its name, at fixed points of the integration framework. A script with the wrong name never runs, and nothing reports it. This article lists every script point, the name Manage looks for, and the traps that apply to all of them.

This article opens Part 5, about integration scripts. We checked IBM’s integration pages against the behaviour of Manage in the MAS 9.2 series, and we checked the methods of IBM’s examples on our test system. Where the pages and Manage disagree, this page follows Manage.

Found by name
#

The Automation Scripts application creates integration scripts through a wizard: Create, then Script for Integration. The wizard builds the name from your choices, and that name is the only link between the script and its object structure, channel or service. Neither IBM page lists the names:

Script pointName Manage looks for
Object structure, inbound processingOSIN.<STRUCTURE>
Object structure, outbound definitionOSOUT.<STRUCTURE>
Publish channel, event filterPUBLISH.<CHANNEL>.EVENTFILTER
Publish channel, external exitPUBLISH.<CHANNEL>.EXTEXIT.OUT
Enterprise service, external exit<MESSAGETYPE>.<SERVICE>.EXTEXIT.IN, the response .OUT
Invoke channel, request and responseINVOKE.<CHANNEL>.EXTEXIT.OUT and .IN
REST query and actionOSQUERY.<STRUCTURE>.<QUERY>, OSACTION.<STRUCTURE>.<ACTION>

The user exits use the same names with USEREXIT in place of EXTEXIT, and one more part for the moment: USEREXIT.OUT.BEFORE, USEREXIT.OUT.AFTER, USEREXIT.IN.BEFORE and USEREXIT.IN.AFTER.

Three details decide whether the name matches:

  • Upper case. The names are stored in upper case.
  • The message type is part of the name. A publish channel uses its own message type, which is normally Publish. A channel with another message type looks for another name than the wizard wrote. An enterprise service starts with its message type, for example SYNC..
  • Endpoints are different. An endpoint names its script in a property. Article 20 covers them.

The order of the exits
#

Where the scripts run on the way out and on the way in Where the scripts run on the way out and on the way in
Where the scripts run on the way out and on the way in

On the way out, the event filter runs before anything is serialized, so it is the cheap place to drop an event. The exits get the serialized message, so dropping data there costs the serialization first. On the way in, the exits run before the processing class.

The exits run once for each enabled external system of a channel. service.raiseSkipTransaction() skips the message for that one system, and the loop goes on with the next. In an enterprise service, the same call ends the message quietly.

What each exit sees
#

Two variables carry the message: irData, the internal format of Manage, and erData, the external format.

ExitWay outWay in
Before user exitirData onlyerData only
External exitirData; erData is None and the script fills iterData; irData is None and the script fills it
After user exitboth: erData is the external exit’s resultboth: erData is the original input

Two shortcuts help. On the way out, an external exit can change irData and leave erData empty; the changed irData is then sent. On the way in, an external exit that leaves irData empty passes erData on unchanged.

The exits also get ifaceType, ifaceName, osName, messageType, extSystem and userInfo. The external exit also gets conn, a database connection that is freed when the exit returns. Invoke channel exits get messageType Invoke and extSystem None.

The user exits get one more: beforeExtExit. On the way in it is true in the before exit and false in the after exit. On the way out the two values are swapped. Each exit is a script of its own, so the script already knows where it runs, and the flag is best left alone.

Traps that apply to every integration script
#

JDOM 2. Manage 9.2 uses JDOM 2, in the package org.jdom2. IBM’s examples import org.jdom. On our test system, from org.jdom import Element failed with “No module named jdom”. Import Namespace and Element from org.jdom2.

The Interface flag. Object structure scripts and endpoint exits work through named functions, and Manage calls such a function only when the script has the Interface flag. Manage sets the flag by itself only for new scripts whose names start with OSIN., OSOUT. or LIB.. For any other callback script, set it yourself. Otherwise the source runs once from top to bottom, and no function is called. Inside such a function, the global service does not exist. Use the object the function receives, which offers the same methods.

The class field. Saving an exit script fills in the script exit class on its channel or service when that field is empty. A channel that already names another class refuses the save.

Enterprise services
#

An enterprise service turns an external message into the internal format. Three corrections to IBM’s examples:

  • Reading XML. erData.getData() returns a JDOM 2 document. The Namespace for getChildText must come from org.jdom2.
  • Reading JSON. OslcUtils.bytesToJSON(erData.getOriginalByteData()) gives the JSON object, as IBM shows.
  • Setting a number. IBM’s after user exit calls irData.setCurrentDataAsInt. That method does not exist; on our test system it was missing. Use irData.setCurrentData("wopriority", 1).

Invoke channels
#

An invoke channel calls an external system and can map the answer back. The request exits run on the way out, and the response exits run on the way in, but only when the channel has “process response” set.

A request exit can add query parameters to the call: a map under HTTPHandler.HTTPGET_URLPROPS, stored as the ENDPOINTPROPS property of the current integration context. IBM’s guide shows the full code. The IBM Docs copy stops before the line that stores the map, so its parameters are never sent.

A response exit can write the answer straight onto the record. The integration context property targetobject holds the record that the channel was called for. Set the values on it, then call service.raiseSkipTransaction() to skip the rest of the processing. The call to the channel then returns None.

One trap sits in the call itself. service.invokeChannel("zipchannel") looks the channel up by its exact name. It finds the channel only when it was saved in exactly that case. Otherwise the call fails with a NullPointerException. Write the name exactly as the channel is saved.

What IBM’s pages get wrong here
#

TopicIBM’s pagesWhat Manage does
The namesnot listedthe table above; the message type is part of the name
JDOMfrom org.jdom import ...Manage 9.2 has org.jdom2; the old import fails
setCurrentDataAsIntsets an integerdoes not exist; use setCurrentData
beforeExtExittrue before, false afterswapped on the way out
IBM Docs’ invoke request exitstores the parametersstops before the line that stores them
IBM’s external exit for vendorsbuilds the internal messagethe guide’s copy misses an import and writes false; the IBM Docs copy never builds irData

Article 33 of this series collects the corrections that matter most.

What comes next
#

Article 19 covers object structure scripts: the inbound and outbound hooks.

IBM’s own pages are the reference to keep next to this series:

The complete list of corrections, with the evidence for each one, is in our member area. Members get access on request, so get in touch if you want it. If you want help with the scripts in your own Manage, our services page shows how we work.

IBM and Maximo are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide.

Maximo Automation Scripts - This article is part of a series.
Part 18: This Article