Results 1 to 10 of 10

Thread: Can icePHP connect to Ice server by iceGrid Mode?

  1. #1
    meizhe is offline Registered User
    Join Date
    Jun 2006
    Posts
    7

    Can icePHP connect to Ice server by iceGrid Mode?

    How config?
    full:meizhe liu
    addr:china peking
    project:authenticate

  2. #2
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    As Benoit previously told you before we can offer you any assistance you must fill in your signature details. The instructions are contained http://www.zeroc.com/vbulletin/showt...=7297#post7297.
    Last edited by matthew; 06-14-2006 at 07:38 AM.

  3. #3
    meizhe is offline Registered User
    Join Date
    Jun 2006
    Posts
    7

    up

    up,up,up

    up,up,up

    up,up,up

    up,up,up
    full:meizhe liu
    addr:china peking
    project:authenticate

  4. #4
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    Yes, it's possible for an IcePHP client to connect to a server managed by IceGrid. Like any Ice client, you just need to configure IcePHP with the locator proxy of the IceGrid locator (with the Ice.Default.Locator property). See the Ice manual for more information (section 30.16 contains information about configuring an Ice client to use a locator and the IceGrid chapter also contains information on configuring clients to use the IceGrid locator, section 36.4 in particular).

    Cheers,
    Benoit.

  5. #5
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    More specifically for IcePHP, you can specify this Ice.Default.Locator property either in a configuration file (use the ice.config php configuration property) or on the command line (ice.options configuration property).

    For example, if the IceGrid registry is located on host foo.com at port 10000 and uses the IceGrid instance name MyIceGrid (IceGrid.InstanceName=MyIceGrid in the IceGrid configuration file) then you can use:

    ice.options=--Ice.Default.Locator=MyIceGrid/Locator:tcp -h foo.com -p 10000

  6. #6
    meizhe is offline Registered User
    Join Date
    Jun 2006
    Posts
    7

    help

    my php.ini config:
    ice.slice = "-I/root/ice /root/ice/Util.ice /root/ice/Passport.ice"
    ice.options="--Ice.Default.Locator=pce/Locator:tcp -h 172.16.0.97 -p 12000"

    the Passport.ice is:
    #ifndef PASSPORT_CORE
    #define PASSPORT_CORE

    #include "Util.ice"

    module oak{
    module passport{
    module core{

    exception PassportException
    {
    string message;
    };

    exception NoSuchUserException extends PassportException{};
    exception InvalidPasswordException extends PassportException{};

    class NameToId{//ReverseNameToId
    int uid;
    int getId();
    };


    //interface
    class PassportManager{
    MyUtil::Str2StrMap getUserById(int id);
    MyUtil::Str2StrMap getUserByUsername(string username);
    MyUtil::Str2StrMap getUserByNickname(string nickname);
    MyUtil::Str2StrMap getUserByName(string name);

    MyUtil::Str2StrMap getUserExtById(int id);

    MyUtil::Str2StrMap loginById(int id,string password);
    MyUtil::Str2StrMap loginByUsername(string username,string password);
    MyUtil::Str2StrMap loginByNickname(string nickname,string password);
    MyUtil::Str2StrMap loginByName(string name,string password);

    MyUtil::Str2StrMap registerUser(MyUtil::Str2StrMap props,MyUtil::Str2StrMap extprops);

    void modifyUser(int uid, MyUtil::Str2StrMap props,MyUtil::Str2StrMap extprops);
    void modifyUserPassword(int uid,string oldpwd,string password);
    void resetUserPassword(int uid,string password);

    void initNameToId();
    };


    }; }; };



    #endif


    my php scripts:
    <?php
    ice_loadProfile();
    //ice_dumpProfile();

    try
    {
    $base = $ICE->stringToProxy("PassportManager:default -p 12000");
    $passport = $base->ice_checkedCast(":ak:assport::core::PassportManager");

    $name = $passport->getUserById(1);
    print $name;
    }
    catch(Ice_LocalException $ex)
    {
    print_r($ex);
    }
    ?>

    It throw the error below:

    Ice_UnknownLocalException Object
    (
    [unknown] => Network.cpp:669: Ice::ConnectionRefusedException:
    connection refused: Connection refused
    [messagerotected] =>
    [stringrivate] =>
    [coderotected] => 0
    [filerotected] => /usr/local/bin/passport.php
    [linerotected] => 8
    [tracerivate] => Array
    (
    [0] => Array
    (
    [file] => /usr/local/bin/passport.php
    [line] => 8
    [function] => ice_checkedCast
    [class] => Ice_ObjectPrx
    [type] => ->
    [args] => Array
    (
    [0] => :ak:assport::core::PassportManager
    )

    )

    )

    )

    please help me!
    full:meizhe liu
    addr:china peking
    project:authenticate

  7. #7
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    The following line in your code:

    Code:
    $base = $ICE->stringToProxy("PassportManager:default -p 12000");
    means that the IcePHP runtime will try to connect to the localhost on port 12000 to try to talk to the object with the identity PassportManager. The Ice::ConnectFailedException indicates that nothing is listening on this port.

    If you registered the PassportManager object as a well-known object with IceGrid, you should simply use the following proxy:

    Code:
    $base = $ICE->stringToProxy("PassportManager);
    Did you register this object as a well-known object? (either through the IceGrid deployment mechanism or directly with the icegridadmin tool or admin interface).

    Cheers,
    Benoit.

  8. #8
    meizhe is offline Registered User
    Join Date
    Jun 2006
    Posts
    7
    the php.ini set
    ice.slice = "-I/root/ice /root/ice/Util.ice /root/ice/Passport.ice"
    ice.config="/root/ice/ice.config"


    my ice.config

    Ice.MessageSizeMax=10240


    Service.Passport.Adapter=@Passport
    Service.Passport.PassportManager.Identity=Passport Manager

    Service.Waist.Adapter=@Waist
    Service.Waist.WaistManager.Identity=WaistManager

    Service.Consume.Adapter=@Consume
    Service.Consume.AccountManager.Category=AccountMan ager

    Service.Statistics.StatisticsManager.Category=Stat isticsManager
    Service.Statistics.Adapter=@Statistics

    Ice.Default.Locator=pce/Locator:default -h 211.100.33.107 -p 12000

    if change the code to:

    <?php
    ice_loadProfile();
    //ice_dumpProfile();
    try
    {
    $base = $ICE->stringToProxy("PassportManager");
    $passport = $base->ice_checkedCast(":ak:assport::core::PassportManager");

    $name = $passport->getUserById(1);
    print $name;
    }
    catch(Ice_LocalException $ex)
    {
    print_r($ex);
    }
    ?>

    then throw
    Ice_UnknownLocalException Object
    (
    [unknown] => LocatorInfo.cpp:337: Ice::NotRegisteredException:
    no object with id `PassportManager' is registered
    [messagerotected] =>
    [stringrivate] =>
    [coderotected] => 0
    [filerotected] => /usr/local/bin/passport.php
    [linerotected] => 7
    [tracerivate] => Array
    (
    [0] => Array
    (
    [file] => /usr/local/bin/passport.php
    [line] => 7
    [function] => ice_checkedCast
    [class] => Ice_ObjectPrx
    [type] => ->
    [args] => Array
    (
    [0] => :ak:assport::core::PassportManager
    )

    )

    )

    )
    Last edited by meizhe; 06-19-2006 at 04:24 AM.
    full:meizhe liu
    addr:china peking
    project:authenticate

  9. #9
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    What are the following properties?

    Code:
    Service.Passport.Adapter=@Passport
    Service.Passport.PassportManager.Identity=Passport Manager
    They are not used in your IcePHP service. Did you register the object with the identity `PassportManager' as a well-known object with IceGrid? The Ice::NotRegisteredException would indicate that you didn't.

    How did you deploy your server? If you deployed your server with an XML descriptor, please post the XML descriptor.

    Cheers,
    Benoit.
    Last edited by matthew; 06-19-2006 at 08:56 AM.

  10. #10
    meizhe is offline Registered User
    Join Date
    Jun 2006
    Posts
    7
    ok,thanks!
    full:meizhe liu
    addr:china peking
    project:authenticate

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How can the server know who connect it?
    By acku711 in forum Help Center
    Replies: 2
    Last Post: 01-07-2009, 08:57 PM
  2. [help]how to connect a server by ip?
    By joise in forum Help Center
    Replies: 5
    Last Post: 06-30-2006, 05:11 AM
  3. Replies: 4
    Last Post: 03-31-2004, 08:45 PM
  4. Replies: 3
    Last Post: 03-31-2004, 07:13 PM
  5. Replies: 4
    Last Post: 02-28-2004, 01:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •