Archived

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

Icepack and PHP

Hi,

We have a simple server written in python and deployed with icepack. It's working fine with a python client.

We tried to rewrite the client in PHP and we followed the pointers given in this thread
http://www.zeroc.com/vbulletin/showthread.php?t=871

But, we are getting an error like this:
Fatal error: Ice_ObjectPrx::ice_checkedCast() [function.ice-checkedCast]: 
no Slice definition found for type ::IcePack::Query in testclient.php on line 5

Here's our PHP code:
<?php
Ice_loadProfile("pyce");
global $ICE;
$query = $ICE->stringToProxy("IcePack/Query")->ice_checkedCast("::IcePack::Query");
$obj = $query->findObjectByType("::Demo::Hello");
if($obj != null)
{
    $calc = $obj->ice_checkedCast("Hello");
}
?>

What could be the problem ?

Rgds,

Comments

  • mes
    mes California
    Hi,

    Are you loading the IcePack Slice files into your "pyce" profile? If so, can you show your IcePHP configuration?

    Take care,
    - Mark
  • Relevant part from the php.ini
    [Ice]
    ice.profiles = "/home/sac/ice/pyce/ice.profile"
    

    ice.profile
    [pyce]
    ice.slice = "/home/sac/ice/pyce/Hello.ice"
    ice.config = "/home/sac/ice/pyce/config"
    

    Hello.ice
    module Demo {
           interface Hello {
                     void printHello();
            };
    };
    

    config
    #
    # The IcePack locator proxy.
    #
    Ice.Default.Locator=IcePack/Locator:default -p 12000
    
    #
    # IcePack registry configuration.
    #
    IcePack.Registry.Client.Endpoints=default -p 12000
    IcePack.Registry.Server.Endpoints=default
    IcePack.Registry.Internal.Endpoints=default
    IcePack.Registry.Admin.Endpoints=default
    IcePack.Registry.Data=db/registry
    IcePack.Registry.DynamicRegistration=1
    
    #
    # IcePack node configuration.
    #
    IcePack.Node.Name=node1
    IcePack.Node.Endpoints=default
    IcePack.Node.Data=db/node
    IcePack.Node.CollocateRegistry=1
    # Ice.Trace.Network=2
    # IcePack.Node.Trace.Activator=3
    
  • mes
    mes California
    You need to change your ice.slice directive so that it also loads the Slice file that defines the IcePack::Query interface. For example:
    ice.slice = "-I/home/sac/Ice-2.1.2/slice /home/sac/ice/pyce/Hello.ice /home/sac/Ice-2.1.2/slice/IcePack/Query.ice"
    
    - Mark
  • mes
    mes California
    By the way, please update your signature to contain the information we requested in our support policy.

    Thanks,
    - Mark