To bind a variable dynamically, use functions in the ServiceLib EGL library instead of the @BindService property. This option is not available for access of a dedicated service from a Rich UI handler or related library.
<webBinding interface="interfaces.SpeechTranslator"
name="TranslateSpanish" port="SpanishPort"/>
<webBinding interface="interfaces.SpeechTranslator"
name="TranslateGerman" port="GermanPort"/>
You might create and bind two variables, one for each
of these entries. Alternatively, you can create one variable that
is based on the Interface part that the entries share. Then, you can
use the ServiceLib.bindService() system
function to bind the variable to the service to use:myTranslator SpeechTranslator;
myTranslator = ServiceLib.bindService("TranslateSpanish");
In
this case, the myTranslator variable is now bound
to the entry named TranslateSpanish.mySpanishString string = myTranslator.translate
("This sentence is in Spanish");
myTranslator = ServiceLib.bindService("TranslateGerman");
myGermanString string = myTranslator.translate
("This sentence is in German");