Cao activation retains the status even when it is called through SOAP, and allows object reference to be passed back and forth through SOAP. The names and values are kept in the class instance on the server, and the reference can work correctly. Both scripts call the same C # component, but the. NET Remoting activation model is different.
In addition to using CreateObject to call cao activation, you can also use a name object with COM +, which can provide cao activation to replace WKO (type name and Assembly name object ). The following script:
'Directly create two objects
Set c1 = GetObject ("soap: typename = RefPass. Child, assembly = RefPass ")
Set c2 = GetObject ("soap: typename = RefPass. Child, assembly = RefPass ")
'Set the name of the first object and call it several times
'To increment the internal counter of the object
C1.SetName ("C1 ")
WScript. Echo c1.CountUp ()
WScript. Echo c1.CountUp ()
WScript. Echo c1.Countup ()
WScript. Echo c1.CountUp ()
WScript. Echo c1.Countup ()
'Set the name of the second object and call it several times
'To increment the internal counter of the object
C2.SetName ("C2 ")
WScript. Echo c2.CountUp ()
WScript. Echo c2.CountUp ()
WScript. Echo c2.Countup ()
WScript. Echo c2.CountUp ()
WScript. Echo c2.Countup ()
'Create parent object
Set p = GetObject ("soap: typename = RefPass. Parent, assembly = RefPass ")
'Pass the sub-object to the parent object and call the sub-object from the parent object
WScript. Echo p. SetRef (c1)
WScript. Echo p. CountUp (c2)
WScript. Echo p. CountUp (c2)
WScript. Echo p. CountUp (c2)
WScript. Echo p. CountUp (c2)
'Call the sub-objects stored in the parent object now
Dim c9
WScript. Echo p. CountUp (c9)
'Get this object from the parent object and call it directly
Set c3 = p. GetRef ()
WScript. Echo c3.CountUp ()
The following output is displayed:
C: moniker> refpassca