ServiceLib.completeBind function

ServiceLib.completeBind causes a service-access variable to reference a binding that was created or updated at run time.

Package

eglx.services

Syntax
static function completeBind (serviceAccessVariable any out, 
                              http any const in)
                returns(any); // serviceAccessVariable
serviceAccessVariable
The service-access variable that will reference a new or updated binding. The variable is received by the function and returned.
http
A service-binding object of a type that matches a type of entry that is valid in the EGL deployment descriptor. For details, see the example and comments later in this topic.
Example use

Here is example code, which prepares a variable that is later used in a service-invocation statement:

myService IMyService;    
myBinding HttpRest{@Resource};
myBinding.request.encoding = Encoding.json;
myService = Servicelib.completeBind(myService, myBinding);
Comments
The declaration of the binding object takes either of two forms:
  • One option is to retrieve an object that contains the data stored in the binding entry of the EGL deployment descriptor. Either of these two statements fulfills the need for HTTPRest:
    myBinding HttpRest{@Resource};
    
    // or
    myBinding HttpRest = SysLib.getResource("myBinding");

    In either case, the EGL runtime code accesses the deployment-descriptor entry named myBinding.

  • Alternatively, create a binding object in which you set all the fields of interest:
    myBinding HttpRest = new HttpRest{
       restType = eglx.rest.ServiceType.TrueRest,	
       uri = "www.example.com/myproject/restservices/weather_service};
Compatibility

Table 1. Compatibility
Target Issue
Java No issues.
JavaScript No issues.