Declaring a variable to access a dedicated or local EGL service

After you code an EGL Service part, you can use that part as the basis of a service-access variable. Two cases are possible:

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.

Here is an example Interface part that might be used to access an EGL service:
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.

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.

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.

The process for setting the EGL binding in the deployment descriptor is as follows:
  1. Double click the deployment descriptor.
  2. On the Service Bindings tab, under Service 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 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.

Assigning the EGL binding to the service-access variable

If you are assigning the EGL binding for a local service at development time, include the @BindService complex property when you declare the service-access variable. Here is an example:
myService MyInterfacePart {@BindService{bindingKey="MyInterfacePart"}};
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 MyInterfacePart:
MyService MyInterfacePart {@BindService};

For details on assigning or reassigning the service binding at run time, see “Binding a service-access variable dynamically.”


Feedback