How config?
![]()
|
|
How config?
![]()
full:meizhe liu
addr:china peking
project:authenticate
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.
up,up,up
up,up,up
up,up,up
up,up,up
full:meizhe liu
addr:china peking
project:authenticate
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.
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
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
Hi,
The following line in your code:
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.Code:$base = $ICE->stringToProxy("PassportManager:default -p 12000");
If you registered the PassportManager object as a well-known object with IceGrid, you should simply use the following proxy:
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).Code:$base = $ICE->stringToProxy("PassportManager);
Cheers,
Benoit.
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
Hi,
What are the following properties?
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.Code:Service.Passport.Adapter=@Passport Service.Passport.PassportManager.Identity=Passport Manager
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.
ok,thanks!![]()
full:meizhe liu
addr:china peking
project:authenticate
There are currently 1 users browsing this thread. (0 members and 1 guests)