Archived

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

how to call IcePack in php

hi,

I use IcePack to administrate my servers now. It works well. I hope find my proxy by IcePack in PHP. Should I write the PHP code?

The endpoint of IcePack Node is "default -p 12000".

In C++, the codes are followed:

IcePack::QueryPrx query = IcePack::QueryPrx::checkedCast(communicator->stringToProxy("IcePack/Query"));
CalculatorPrx calc = CalculatorPrx::checkedCast(query->findObjectByType("::Calc"));

In PHP, I don't know.

Thanks in advance.

Regards,

Comments

  • mes
    mes California
    The code to do this in PHP is pretty similar:
    $query = $ICE->stringToProxy("IcePack/Query")->ice_checkedCast("::IcePack::Query");
    $obj = $query->findObjectByType("::Calc");
    if($obj != null)
    {
        $calc = $obj->ice_checkedCast("::Calculator");
    }
    

    Hope that helps,
    - Mark
  • Thanks for your reply.

    If the IcePack node is reside on another host whose IP is '192.168.0.157', how to specifiy the endpoint?

    Regards,
  • mes
    mes California
    Originally posted by fengxb
    If the IcePack node is reside on another host whose IP is '192.168.0.157', how to specifiy the endpoint?
    Use -h 192.168.0.157. See Appendix D in the Ice manual for more information.

    Take care,
    - Mark
  • In the example, $obj can be got. But next statement throws an exception: [unknown] => Reference.cpp:711: Ice::NoEndpointException:
    no suitable endpoint available for proxy `CalculatorApp -t @ CalculatorApp.Calculator'

    BTW, client is on another machine. Does I miss some configure?
  • mes
    mes California
    Did you define the Ice.Default.Locator property in the PHP configuration? If not, that is most likely the reason for the exception. See the IcePack chapter in the manual for more information on this property.

    Take care,
    - Mark
  • Thanks a lot. I have resolve the problem by adding a definition in PHP configuration.