Resources that are accessed by a service

A service can directly access the following resources: services, relational databases, programs, files, and queues. In most cases, the following rules apply:

Service access

You access a service by using a variable that you code in the requester; that is, in the accessing service. The variable is based on an Interface part or on a Service part. For example, the following code accesses the service, which is shown in “Service development”:
returnValue String{};
myInterface MyService{};

try
   returnValue = myInterface.myEcho("world");

   onException(except AnyException)
      // exception handling
end

You specify access details either directly in the requester or in the EGL deployment descriptor that is used to generate the requester.

For additional details on service access, see “Service access in EGL.”

Relational database access

You access a relational database by using data access statements, such as add and delete. You have various options for writing EGL statements and can even write code in the traditional database-access language, Structured Query Language (SQL).

You specify the database-access detail by updating options in the build descriptor. A different set of build descriptor options are used for the EGL debugger and for run time.

For additional details about accessing a relational database, see “EGL support for relational data.”

Program access

Program access has two variations. Typically, the program is structured so that the service can invoke the program synchronously, which means that the service waits for the program to return control. However, in some cases, the program is structured so that the invoker can invoke the program asynchronously, which means that the service starts the program and continues processing.

You cause synchronous access by coding a call statement in your service. You specify the communications detail as follows:
  1. Add detail to a linkage options part in the build file; in particular, update the callLink element in that part. If you want to set the communications detail only at run time, as is possible for a remote program invocation, set the callLink element appropriately and then establish and deploy a linkage properties file.
  2. Update the build descriptor so that it references the linkage options part

For details about the linkage options parts, see “Linkage options part.”

File, MQSeries message queue, or IBM i object access

You can access files, MQSeries® message queues, printers, or IBM® i objects by using data access statements such as add. You specify additional access detail as follows:
  • Add the detail to a resource associations part in the build file
  • Update the build descriptor so that it references the resource associations part
For details, see the following topics:
  • “Resource associations parts” and “Association elements”
  • “Reading from and writing to sequential files"
  • “EGL support for VSAM files”
  • “EGL support for WebSphere® MQ message queues”
  • “EGL support for IBM i objects"

Feedback