Archived

This forum has been archived. Please start a new discussion on GitHub.

Ruby: Passing stringified proxies to web clients

I want to basically URL encode some sringified proxy, pass it to the web client and then when it is returned, turn this back into a proxy.

IOW, I want to do this (NOTE: the variable ice is the ice communicator):

strID = ice.proxyToString(objData);
objDataClone = ice.stringToProxy(strID);
puts objData
puts objClone
objData.foo()
objDataClone.foo()

The two puts statements produce identical output. Yet, objDat.foo() works as expected but objDataClone.foo() produces:
test.rb:128: undefined method 'foo' for #<Ice::ObjectPrx:0x34272e1> NoMethodError

What am I missing? Also, I'm not sure if this entire approach is good practise or not.

Comments

  • Oops, I can answer the first question myself: I need to cast the returned proxy into a proxy of the appropriate type.

    Still, is it a good idea to pass stringified proxies to web clients and turning them back into proxies in subsequent requests to the server?