IceGrid Problem using PHP

cncrazyzzcncrazyzz Scott TanOrganization: FuYuan Inc.Project: Using in web applicationMember
my php code:
Ice_loadProfile("Profile1")
try
{
        $base = $ICE->stringToProxy("MyServ");
        $obj = $base->ice_checkedCast("::Serv::User");

        $friends = $obj->getInfoByUserIDs(27, 0, 8);
        var_dump($friends);
} catch(Ice_LocalException $ex) {
        /* do nothing */
        var_dump($ex);
}

then the error msg is:
Reference.cpp:1142: Ice::NoEndpointException:
no suitable endpoint available for proxy `MyServ -t'

other infomations:
icegridregistry --Ice.Config=registry.cfg

registry.cfg:
IceGrid.Registry.Client.Endpoints=tcp -p 10000
IceGrid.Registry.Server.Endpoints=tcp
IceGrid.Registry.Internal.Endpoints=tcp
IceGrid.Registry.AdminPermissionsVerifier=IceGrid/NullPermissionsVerifier
IceGrid.Registry.Data=/opt/Ice-3.2.1/p/grid/registry
IceGrid.Registry.DynamicRegistration=1

./server --daemon --Ice.UseSyslog=1 --Ice.Config=node.cfg

node.cfg:
MyServ.AdapterId=MyServ
MyServ.Endpoints=tcp
Ice.Default.Locator=IceGrid/Locator:tcp -h hostip -p 10000

and php.ini
ice.profiles="/opt/p/php/etc/ice.profiles"
ice.options="--Ice.Override.ConnectTimeout=5"
ice.options="--Ice.Default.Locator=IceGrid/Locator:tcp -h hostip -p 10000"

Comments

  • matthewmatthew NL, CanadaMatthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications EngineMember ✭✭✭
    ice.options="--Ice.Override.ConnectTimeout=5"
    ice.options="--Ice.Default.Locator=IceGrid/Locator:tcp -h hostip -p 10000"
    

    The ice.options argument is not cumulative. That is the second overrides the first. You must put all of the arguments on the same line. In addition, you need another set of quotes in definition of Ice.Default.Locator since the arguments are split on whitespace. Something like: --Ice.Default.Locator='IceGrid/Locator:tcp -h hostip -p 10000'.
  • cncrazyzzcncrazyzz Scott TanOrganization: FuYuan Inc.Project: Using in web applicationMember
    Modified

    I had modified the php config,but the problem remains.

    following are my server code.should I do some modify for IceGrid?
    ic = Ice::initialize(argc, argv);
    Ice::ObjectAdapterPtr adapter = ic->createObjectAdapter("MyServ");
    
    Ice::ObjectPtr user = new UserI;
    adapter->add(user, ic->stringToIdentity("ServUser"));
    
    adapter->activate();
    
    ic->waitForShutdown();
    
  • matthewmatthew NL, CanadaMatthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications EngineMember ✭✭✭
            $base = $ICE->stringToProxy("MyServ");
    

    Here you resolve an object with the id "MyServ". Have you registered this as a well known object? If not, then this is likely your problem. What you likely want to do is:
            $base = $ICE->stringToProxy("ServUser @ MyServ");
    

    ServUser because this is the object you've registered in your server on the adapter with the id "MyServ" (or alternatively register this as a well known object).

    If this does not work then next you should enable tracing in the icegrid registry (use IceGrid.Registry.Trace.Locator=2). Do you see the PHP client make contact? If not, then the problem lies with the PHP client. If it does make contact, then the problem likely lies with your IceGrid configuration and/or deployment.

    What I would do first is to try to get your system working with a non-PHP client (perhaps python, or something a little easier to debug). Then once everything is going then you can work out your PHP issues :)

    Finally, I recommend reading Michi's article "Teach yourself IceGrid in 10 minutes". You can find the article at http://www.zeroc.com/newsletter.
  • cncrazyzzcncrazyzz Scott TanOrganization: FuYuan Inc.Project: Using in web applicationMember
    thx

    thx,
    It works
Sign In or Register to comment.