To bind a variable dynamically, use functions in the ServiceLib EGL library instead of the @BindService property. This option is not available for local access of a 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, and then use the ServiceLib.bindService() system function to bind the variable to the service that you want 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");