Archived

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

ice_checkedCast fails

I can't figure out where I'm mishandling ice_checkedCast.

Real simple script:

[PHP]
Ice_loadProfile("Test");
$proxy = $ICE->stringToProxy("test:tcp -p 12001"); // i called this "test" when i added it to the server's adaptor
$proxy = $proxy->ice_checkedCast("TestServer::TestClass");
$proxy->write("Test");
[/PHP]

Fails on write() with Fatal error: main(): unknown operation in c:\Code\www\docroot\icetest.php on line 6

before write() is performed, $proxy is still an Ice_ObjectPrx Object and a typed proxy. The manual leads me to believe that checkedCast is failing and thus returning a null proxy. If I put in anything but TestServer::TestClass I get an error that there is no slice defined, as one would expect.

Here's the slice, let me know what you think.
module TestServer {
	
	interface TestMethods {
		string getString();
		int getInt();
	};
	
	class TestObject implements TestMethods
	{
		int id;
	};
	
	interface TestClass 
	{
		void throwError();
		
		TestObject getObject(int id);
		int getInt();
	};

};

Comments

  • mes
    mes California
    Hi,

    Your code is attempting to invoke the operation write using the proxy. However, I don't see any such operation defined in your Slice code, so I'm not surprised you're getting an error. What is this code attempting to do?

    Take care,
    - Mark
  • It's defined in mine. I must have had an older copy open in a buffer, sorry.

    Anyway, the problem has to do with ICE preloading the slice definition. I needed to cycle the webserver. It works now. :-D