Using XML

When you generate a task interface object, a task file is always generated regardless of your other selections. Task files are XML interface objects that implement the IConnectorAccess interface. They are used either directly by your application, or internally by the Runtime Service when you develop applications that use another type of task interface object.

Note The XML task interface object is accessed through the task file created when any task interface object is generated.

The workflow

This is an example of a general synchronous workflow:
  1. A client calls open() and passes the unique identifier (for example, a URL or file name) of a document containing a group of tasks and optional metadata about the tasks. If metadata is provided, then all inputs and outputs must abide by the metadata.

  2. The connector retrieves the task file.

  3. The client calls getMetaData() to find out what tasks are available and what they "look" like.

  4. Metadata is returned as an XML string.

  5. If necessary, the client sets the timeOut and maxSize properties.

  6. The client calls execute() and specifies a task and the input data needed to execute the task.

  7. The connector retrieves the task data, initiates the task, and returns when done.

  8. The client loops and calls getData to retrieve the results and then checks the available property to see if more data is remaining.

  9. The connector returns up to the maximum size (maxSize property) of the retrieved data and sets the available property to the size of any remaing data.

  10. The client calls close() when the task is finished executing.

  11. The connector releases resources as needed.
Description Example
Instantiate the connector class for your connector. The examples create the instance "myconnector." ScreenConnectorAccessImpl myconnector = new ScreenConnectorAccessImpl();

CICSConnectorAccess myconnector = new CICSConnectorAccess();

IMSConnectorAccess myconnector = new IMSConnectorAccess();
Initialize your connector by opening your task file. The argument is the path to the file. myconnector.open (path\to\my_connector.xml);
Get the metadata for your task. If the task id is -1, then all tasks are returned. String xmlString = myconnector.getMetaData(-1);
Optionally, set a timeout for the task execution. The default is -1, indicating no timeout is set. myconnector.setTimeOut(-1);
Optionally, set the maximum return data size. The default is -1, indicating all data is returned. myconnector.setMaxSize(-1);
Execute the task. The argument is the task id and the task inputs as xml.

There are four optional task inputs available: JobName, ResourceName, InstanceName, and COControlMapping.

myconnector.execute(task_id, inputXML);
Retrieve the data. String outputXML = myconnector.getData(task_id);
Close the connector. This frees the host session. myconnector.close();

Maintaining Session Allocation or Preserving Context

Typically, sessions are allocated just prior to task execution and then freed up immediately after task completion. There may be situations when it is necessary to maintain an allocated session from one task interface object to another. This is called preserving context.

Context is the host connection or session that has been allocated to a task. Pools of host connections are created using MCS, and each task, when executed, is allocated a session/connection. When you "preserve context," the session will not be disconnected after executing the task, making it available for future executions.

Synapta Services Builder for Screens context options are set in the XML task file. The possible values are:

Note XML interface objects cannot transfer or copy context as beans can.
Related Topics
Bullet Using Tasks in Your Applications, Overview
Bullet Sample Task File
Bullet IConnectorAccess Sample Code
  Attachmate