Server Access for J2EE implements support for an application component to
send data to an EIS application that InterChange Server manages. The
application component prepares an
input record and requests execution of a WebSphere Business Integration
Collaboration. When a WebSphere Access Resource Adapter receives an
input record from the application component, the resource adapter initiates a
call-triggered flow by submitting an event to a
collaboration. An application component requests this call-triggered
flow through the interfaces that the CCI provides to drive an interaction (see
Table 10).
Table 10. Server Access for J2EE CCI implementation for executing a collaboration
In Table 10, the Supported Methods column lists those interface methods that Server Access for J2EE implements. Interface methods not listed there fall into one of the following categories:
All other methods in this interface are not implemented; that is, a call to one of these interface methods not listed does not generate a compile error but the method has no functionality.
Keep the following points in mind when requesting execution of a collaboration through an Access Resource Adapter:
An Access Resource Adapter supports only access-request operations, which are events that the application component initiates and needs to send to some EIS application. This resource adapter does not support event notification; that is, it cannot support events that some other WebSphere business integration system component has initiated.
If ICS unexpectedly terminates during execution of the call-triggered flow, the application component is not notified of the failure through an
exception. However, the Access Resource Adapter would be informed whether the request could be processed before the termination. To recover:
For more information on call-triggered flow, see the Access Development Guide.
Initiating a call-triggered flow in the application component involves the following steps:
The InteractionSpec interface provides interaction-specific properties. The implementation of the InteractionSpec interface that Server Access for J2EE provides is called CwInteractionSpec. The application component defines how it wants to interact with InterChange Server through a CwInteractionSpec instance.
Table 11 shows the standard interaction properties of the
InteractionSpec interface. As Table 11 shows, the CwInteractionSpec interface
supports two of these standard properties.
The first step in requesting a call-triggered flow is to identify the collaboration that needs to execute. To identify the collaboration, specify the collaboration name, port, and verb in the CwInteractionSpec instance. Use the following syntax to set the FunctionName standard property to include the name and port of the collaboration, as well as the verb:
CollaborationName:Port:CollaborationVerb
As the syntax above indicates, a colon (:) separates each of these pieces of information.
You can set the FunctionName standard property in either of the following ways:
The following line of code identifies the collaboration based on the initial value provided to the CwInteractionSpec() constructor:
iSpec = new CwInteractionSpec("Customer:NewCust:Create");
This initial value specifies initiation of the Customer collaboration, which creates a new customer from the business object it receives on its NewCust port.
The following lines of code identify the collaboration based on the argument passed to the setFunctionName() method:
iSpec = new CwInteractionSpec(); iSpec.setFunctionName("Customer:NewCust:Create");
This argument in setFunctionName() specifies initiation of the Customer collaboration, which creates a new customer from the business object it receives on its NewCust port.
The application component stores the data to send to an EIS in an input record. The WebSphere Access Resource Adapter converts this input record into a business object, which is the triggering event for the collaboration. The Server Access for J2EE's implementation of the MappedRecord interface, CwMappedRecord, holds this serialized input record, which the application component then passes to the Interaction.execute() method.
If the verb for the collaboration is not specified in the InteractionSpec instance, the resource adapter extracts the verb from the top-level CwMappedRecord that is passed into the execute() method.
For more information on CwMappedRecord and CwIndexedRecord and how to create them, see "Using records".
The CCI method that actually sends the request to initiate the call-triggered flow is Interaction.execute(). The implementation of execute() that Server Access for J2EE provides takes the following steps:
To call the execute() method, the application component must take the following steps:
Server Access for J2EE supports the following two forms of the Interaction.execute() method:
execute(InteractionSpec, input_record, output_record)
output_record = execute(InteractionSpec, input_record)
The following pseudo-code shows how an application component can request information about an employee named "Stan Smith":
// Obtain the input record (a CwMappedRecord instance) and populate it inputRecord = connFactory.getRecordFactory().createMappedRecord("Employee"); inputRecord.put("FirstName", "Stan"); inputRecord.put("LastName", "Smith"); // Set the interaction-specific properties in the CwInteractionSpec iSpec = new CwInteractionSpec("myCollab:fromObject:Retrieve"); // Generate the Interaction instance and then execute it myInteraction = myConnection.createInteraction(); outputRecord = myInteraction.execute(iSpec, inputRecord); // Obtain the data from the output record employeeId = outputRecord.get("EmployeeId"); // Close the interaction myInteraction.close();
When the application component is finished using an Interaction instance, it should explicitly close it. A call to the close() method releases all resources that the WebSphere Access Resource Adapter has maintained for the Interaction. The close of an Interaction instance does not close the associated connection handle. It is recommended that you close Interaction instances explicitly to free any held resources.