EGL provides two kinds of support for service-oriented architecture (SOA): service development and service access.
Service MyServicePart
value STRING = "Hello ";
function myEcho(myString STRING IN) returns (STRING)
return (value = myString);
end
end
The content of the Service part is the service implementation. In this case, the implementation accepts an input string such as “world” and returns to the requester the concatenation of “Hello ”and the input string. You can make several functions, or service operations, accessible to service requesters.
An EGL service is accessible to various kinds of EGL code, and the access is relatively fast. However, the EGL service is not a web service and is not accessible to code that is written in another language.
An EGL REST-RPC service access always uses a POST method, but that detail is hidden to the requester. For other details that are meaningful when you access an EGL REST-RPC service from logic written in another language, see “EGL REST-RPC message structure.”
In a Rich UI application, the EGL runtime code rounds any numeric data that is returned by the service and is greater than 15 significant digits. The rounding does not occur when JSON is returned to EGL-generated Java™ code.
Access to an EGL-generated service always conforms to the RPC style rather than to the RESTful style. The parameters and a return value identify the data to exchange. Access to the service does not involve path variables or query parameters.
If you are accessing a service that was written in EGL, you do not need to create an Interface part, but can use the Service part as if it were an Interface part.
myService IMyService{};
For details about the types of data sent to or returned from services, see “Restrictions in the prototypes used for service access.”
Although you can use an EGL Service part as an Interface part, in most cases, use a separate Interface part. For example, you might want to avoid distributing a service implementation to another developer because the service is changeable or confidential. However, you must use a Service part as an Interface part when you are accessing a dedicated service from a Rich UI application, as described in “Service access in Rich UI.”
The runtime architecture for all EGL web service deployments has the same pattern: generated or runtime code acts as an intermediary between the requester and the service. The intermediary code converts data between the text-based format of a service message and the binary format required by the service.
The runtime platform is an application server that is compliant with Java EE. There, the EGL runtime code reads the XML file, invokes the service, and acts as an intermediary between the requester and service.
The service wrapper uses the Java400 or Java400J2C protocol to communicate with the remote catcher program. The catcher program invokes the service and acts as an intermediary between the service wrapper and the service.
The service wrapper and service are local to one another.
Service access from an EGL-generated requester has a consistent pattern: a proxy acts as an intermediary between the EGL-generated requester and the service. The proxy converts data between the format used by the requester and the format required by the service. However, no proxy is in use when an EGL service is local to the requester.
The next table gives further details, by service type.
Characteristic of the requested service | Characteristic of the deployed requester | Characteristic of the proxy |
---|---|---|
dedicated EGL | An HTML file that embeds JavaScript | The proxy is in the EGL runtime code and invokes the service locally, without an HTTP request. |
local EGL | EGL-generated Java code | No proxy is in use. |
EGL-generated COBOL program | ||
remote EGL | EGL-generated Java code | The proxy is in the EGL runtime code. |
EGL-generated COBOL program | Access is not supported. | |
REST or EGL REST-RPC | EGL-generated Java code or an HTML file that embeds JavaScript | The proxy is in the EGL runtime code. |
EGL-generated COBOL program | Access is not supported. | |
SOAP | EGL-generated Java code or an HTML file that embeds JavaScript and that is deployed on an application server that is fully compliant withJava EE, such as IBM WebSphere® Application Server | The proxy is a Java class that is generated from the requester-specific deployment descriptor. |
An EGL-generated Java code or an HTML file that embeds JavaScript and that is deployed on any other platform | The proxy is in the EGL runtime code. | |
EGL-generated COBOL program | The proxy is a COBOL program that is generated from the requester-specific deployment descriptor. |
Another aspect of service access is the location of service-binding detail. For all EGL-generated requesters besides CICS programs, the detail is in an XML file that is generated from the requester-specific deployment descriptor and that is deployed with the requester. For a CICS program, the detail is generated into the program itself.
The initial call to the proxy is slow because the EGL Java runtime code is loaded, including all the JAR files in the classpath. The loading occurs only on the first call or after IBM i unloads the JVM from memory.
A Java runtime property specifies whether the exceptions returned by EGL REST-RPC services include the greatest possible level of detail. See "Description of Java runtime properties"; specifically, the entry for egl.service.rest.exception.debug, which took effect in version 8.5 and higher of the EGL runtime code.
When you deploy EGL-generated SOAP services or EGL-generated SOAP service requesters to IBM WebSphere Application Server, you can use the WS-Addressing and WS-Security capabilities of that application server. The service or service requester must rely on JAX-WS rather than JAX-RPC, as described in “EGL support for JAX-WS and JAX-RPC.”
Access of web services always involves the HTTP protocol, but other protocols are used for accessing COBOL web services and in other cases. For details, see “Sharable protocols.”