Introduction to Interface parts
An Interface part has function prototypes, which are definitions that are used to perform type checking on function calls when the EGL system code does not have access to the functions themselves. The Interface part is the basis of a service-access variable, which is used in the statement that invokes a service.
A second use of the Interface part is as a design tool.
The Interface part as a custom type
If you accessing a service written in a language other than EGL, you must use an Interface part to declare the service-access variable. If you are accessing a service written in EGL, you can use either an Interface part or the related Service part to declare the variable.
- You might want to hide the source code from developers outside of your organization. In particular, you might ship EGL Interface parts to customers, along with the Java™ classes that were generated from the Service part.
- You might want to reduce complexity. The Interface part helps developers focus on the service operations rather than on the internal logic.
Interface IMyService
Function calculate(theList INT[] IN)
returns(BIN (4,2));
// other function prototypes are here
end
myServiceVariable IMyService;
A service-access variable is tied to a service binding, which is a definition that identifies the service location and access protocol. The binding can be in the EGL deployment descriptor, and that practice provides the greatest flexibility. If you are invoking a web service, you can set the binding in the code itself.
For a description of the tasks involved in service access, see Accessing a service.
The Interface part as a design tool
You can also use an Interface part to describe the functionality that you want to see coded in an EGL service. After the Interface part is complete, you or others can code the service, which is said to implement the interface. The meaning of that phrase is that the service contains every function described in the Interface part. The part provides a kind of contract that the service must fulfill.
- Helps developers and business analysts think clearly about what operations are needed in a service before service development begins.
- Helps developers write the service-access code while the service is under development.