Home Help Center

Glacier2 with PHP

triviantrivian Member Thorvald NatvigOrganization: MumbleProject: Mumble
Hi,

Is it possible (in an easy manner) to connect to glacier2 with username/password from the PHP bindings? getDefaultRouter() seems to be missing.

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi Thorvald

    You can connect to Glacier2 from php, but session would expire with each request as the connection could not keep open in php.

    For configure the default router you could use "Ice.Default.Router" property.

    You need something similar this code with normal Exception handling for php
    $router = $this->ice->propertyToProxy("Ice.Default.Router");
    $router = $router->ice_uncheckedCast("::Glacier2::Router")->ice_router(null);
    $session = $router->createSession($username, $password);
    

    Regards,
    José
  • triviantrivian Member Thorvald NatvigOrganization: MumbleProject: Mumble
    Explicit router

    Hi,

    Instead of using a default router, I'd rather specify the router in the php since that avoids using the same router for the entire profile.

    I had to fix a small bug in $obj->ice_router() in Ice-3.3.0 (patch appended); I'm not sure if it was in the patches yet or not, but at least it's not in the RPMs and had me stumped for a while ;)

    Anyway, I still have the problem that if I have a method on the server that returns a proxy (pointer to another instance), that proxy will get the default (null) router in the client.

    For example:
    $s = $meta->getServer();
    
    Here $meta is a proxy for a remote object (as is $s). Before I can use $s, I have to do the equivalent of
    $s->ice_router($meta->ice_getRouter());
    

    Is there a way to specify on the server that it should return a proxy with the same routing/whatever that was used to reach the method that returns the proxy?
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    trivian wrote: »
    I had to fix a small bug in $obj->ice_router() in Ice-3.3.0 (patch appended); I'm not sure if it was in the patches yet or not, but at least it's not in the RPMs and had me stumped for a while ;)
    Thanks for the patch, we'll fix this for the next release (along with a similar bug in ice_locator).
    Is there a way to specify on the server that it should return a proxy with the same routing/whatever that was used to reach the method that returns the proxy?
    No, there's no way to do that. The router is a strictly local configuration that is not included in a proxy's marshaled form.

    Take care,
    Mark
Sign In or Register to comment.