Declaring an access variable to access a local EGL service

With EGL, you can use a shortcut to declare the access variable that is used to invoke a local EGL service. For background information about local EGL services, see “Service access in EGL."
After you code an EGL Service part, you can use that part as the basis of an access variable, as in the following example:
  myService MyServicePart{};

When you work in a Rich UI application, you always use that syntax to access a local EGL service; then you use the variable in a call statement, which is described in “Invoking a service asynchronously from a Rich UI application.”

Accessing a local EGL service from outside of Rich UI

When you work outside of Rich UI, you can use the previous syntax, too. Alternatively, you can do either or both of the following steps:
  • Create an access variable that is based on an Interface part. The part includes function prototypes that match some or all of the functions in the Service part.
    Here is an example Interface part that might be used to access an EGL service; the example includes a single function prototype:
    Interface MyInterfacePart
       Function GetEmployeeDetail(employeeCode STRING IN, 
                                  employeeSalary FLOAT OUT, 
                                  employeeStatus STRING INOUT) 
                returns(myEmployeeRecordPart);
    end

    You can specify a variety of EGL data types and can use the modifiers IN, OUT, and INOUT.

    You can create the Interface part easily from the Service part:
    1. In the Project Explorer, right click the EGL file that defines the service
    2. Click EGL Services > Extract EGL Interface.
    3. In the New EGL Interface part window, specify the appropriate details and click Finish
  • Indicate that the binding detail for service access is in the service-client binding section of the EGL deployment descriptor. The binding information is external to the code and you can change it when you configure the service in an application server.
    1. To indicate that the binding detail is in the EGL deployment descriptor, include the @BindService complex property:
      myService MyServicePart {@BindService{bindingKey="MyServicePart"}};
      The @BindService property has one field:
      bindingKey
      Identifies the deployment-descriptor entry that indicates that the binding is local to the requester.
      You can specify @BindService without specifying the bindingKey field, in which case the property identifies the deployment-descriptor entry that has the same name as the Service or Interface part used in the variable declaration. Here is an example of that usage, which refers to the deployment-descriptor entry named MyServicePart:
      MyService MyServicePart {@BindService{}};
    2. Add the binding detail to the EGL deployment descriptor:
      1. In the deployment descriptor editor, open the deployment descriptor.
      2. On the Service Client Bindings tab, under Service Client Bindings, click Add.
      3. In the Add a Service Binding window, click EGL Binding and then click Next. The Add an EGL binding window is displayed.
      4. Specify a binding key, which is the name of the client-service binding. Either type the binding key or do as follows:
        1. Click the Browse button, which is next to the EGL Binding Name field. The Interface Selection window is displayed.
        2. 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.
        3. Click OK.
      5. Select Local.
      6. 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.

Next, use the variable in a service-invocation statement, as described in “Invoking a service synchronously from outside of Rich UI.”


Feedback