Declaring a variable to access a dedicated or local EGL service
- If you are working in Rich UI, the only accessible EGL service
is a dedicated service, as explained in Service access in Rich
UI. You declare the service-access variable as shown here:
myService MyServicePart{@dedicatedService};In that declaration, you must specify the Service part, not an Interface part.
After declaring the variable, you use it in a call statement, as described in Invoking a service asynchronously from a Rich UI application.
- If you are working outside of Rich UI, the typical procedure is
as follows:
- Defining an Interface part to access a local EGL service
- Setting an EGL binding in the deployment descriptor
- Assigning the EGL binding to the service-access variable
After you declare the variable and assign a service binding to it, you use the variable in a service-access statement, as described in Invoking a service synchronously from outside of Rich UI.
Defining an Interface part to access a local EGL service
When you are accessing a local EGL service outside of Rich UI, you can base the service-access variable on an Interface part. The part includes function prototypes that match some or all of the functions in the Service part.
Interface MyInterfacePart
Function GetEmployeeDetail(employeeCode STRING IN,
employeeSalary FLOAT OUT,
employeeStatus STRING INOUT)
returns(myEmployeeRecordPart);
end
The example includes a single function prototype, but more are possible. Also, you can specify a variety of EGL data types and can use the modifiers IN, OUT, and INOUT.
- In the Project Explorer, right click the EGL file that defines the service.
- Click EGL Services > Extract EGL Interface.
- In the New EGL Interface part window, specify the appropriate details and click Finish.
When accessing a non-SOAP service, avoid a possible runtime error: do not use an Interface part that is derived from a WSDL file.
Setting an EGL binding in the deployment descriptor
When you are working outside of Rich UI and are accessing a local EGL service, you must set the service binding in the EGL deployment descriptor. The rule applies whether you use a Service or Interface part as the basis of the service-access variable.
- Double click the deployment descriptor.
- On the Service Bindings tab, under Service Bindings, click Add.
- In the Add a Service Binding window, click EGL Binding and then click Next. The Add an EGL binding window is displayed.
- Specify a binding key, which is the name of the service binding.
Either type the binding key or do as follows:
- Click the Browse button, which is next to the EGL Binding Name field. The Interface Selection window is displayed.
- Select the name of the Interface part that is the basis of a service-access variable in your code. If that name is the binding key, you do not need to specify the name when you code the @BindService property in your code.
- Click OK.
- Select Local.
- Click Finish. The new client binding is listed in the Service Bindings list. You can update the binding information later in the EGL Service Binding section.
Assigning the EGL binding to the service-access variable
myService MyInterfacePart {@BindService{bindingKey="MyInterfacePart"}};- bindingKey
- Identifies the deployment-descriptor entry that indicates that the binding is local to the requester.
MyInterfacePart:MyService MyInterfacePart {@BindService};For details on assigning or reassigning the service binding at run time, see Binding a service-access variable dynamically.