Community
Participate
Working Groups
This is blocking issue, because I'm porting existing services tests from RBD, I need to initialize the service variable based on the enumeration type I have the following library and ruiHandler, I'm trying to initialize service variable via the initService() function This gives me exception when running the RUIhandler in preview (did not try in deploy mode) import services.myservice; library myLib variableName string = initString(); s myservice = initService(); function initString() returns (String) return ("jing jing"); end function initService() returns (myservice) s1 myservice{@DedicatedService}; return (s1); end end handler h1 type RUIhandler{initialUI =[ ], onConstructionFunction = start, cssFile = "css/a.css", title = "h1"} function start() syslib.writeStdout(myLib.variableName); end end
This is a compiler problem should not be able to declare an interface or service without a ?. Here is the corrected library: library myLib variableName string = initString(); s myservice? = initService(); function initString() returns (String) return ("jing jing"); end function initService() returns (myservice) s1 myservice?{@DedicatedService}; return (s1); end end When there is no ? the generator tries to instantiate a new instance of the service. You can't instantiate a myservice so an exception is throw.
Routing back to JS Gen. JS generator should generate "null" as the new instance of a service, instead of attempting to instantiate the non-existant service.
I talked with Paul about this, and he claimed that this issue was sent back to JS Generation because creating a variable of type Service with out a '?' will be allowed in Java. Is this true? I was under the impression that a Service must always be bound to a 'resource', even if that service is specified in a batch Java application and is referencing a Dedicated Service? Also, it seems that this issue is no longer a blocker and can probably be moved to a severity of 'normal'. If that is the case, please make this change.
lower to normal, p1, as I changed the code according to Joe's suggestion, it works correctly.
fixed. Instead of making this a validation error the js generator set the instantiation to null.
Brian had a meeting about this defect. In RBD we don't allow the instantiation of a service part. A local service is called by binding it and then using the binding to invoke the service. In RBD local service behave differently than a REST or SOAP because at the end of a REST or SOAP function the run unit is ended, with a local call the rununit is the same run unit as the caller. We have not defined how local services should behave in EDT. Instead of allowing user to instantiate a service part in 070 and then trying to remove that functionality in 10 it would be better to restrict it now by not allow the creation of a new service instance. So validation should not allow a service type without a ?.
I have updated ServiceBinding to make services be not instantiable. This results in all variables that are typed to a service to either: 1) be nullable and/or 2) have an initializer
This high severity defect was fixed several weeks ago, so I am closing.