Archived
This forum has been archived. Please start a new discussion on GitHub.
Creating Proxies for "Ice objects" with Python
hiasl
in Help Center
Hi,
i want to write an application (using python) on which a client can create "Ice objects" via an interface.function returning a proxy for each object. for this i create an "Ice object" but i don't know how i can create the proxy object? Here is an example:
class A(IceSuperClass): #implementation of slice interface
...
def createA: #defind with slice
a = A()
return a
calling createA on client side results in an error similar to "wrong return value". Is there any function/method like "a.getProxy()" i can use? Btw. is it a must, that any proxy must be registered at Ice.adapter()?
Thanks & Bye
Matthias
i want to write an application (using python) on which a client can create "Ice objects" via an interface.function returning a proxy for each object. for this i create an "Ice object" but i don't know how i can create the proxy object? Here is an example:
class A(IceSuperClass): #implementation of slice interface
...
def createA: #defind with slice
a = A()
return a
calling createA on client side results in an error similar to "wrong return value". Is there any function/method like "a.getProxy()" i can use? Btw. is it a must, that any proxy must be registered at Ice.adapter()?
Thanks & Bye
Matthias
0
Comments
-
Hi Matthias,
We have a new support policy for the forum. Please see this post for details.
Thanks,
- Mark0 -
Thanks Matthias.
In a server, you normally obtain a proxy from the object adapter, either as the return value of one of the adapter.add operations, or by calling adapter.createProxy.
You can obtain a reference to the object adapter easily enough from the Ice.Current argument passed to createA:def createA(self, curr): id = Ice.stringToIdentity("theIdentityForA") proxy = curr.adapter.createProxy(id) return APrx.uncheckedCast(proxy)This is just one of many ways to do what you ask. This example shows how to create the proxy, but does not show how the Ice object is activated. It wasn't clear from your original post whether each call to createA should create a new object, or just a new proxy to an existing object.
In any event, hopefully this will get you started. Let us know if you have more questions.
Take care,
- Mark0
