Archived
This forum has been archived. Please start a new discussion on GitHub.
Ice::Context issue about different platform
a client on Window as follows:
the proxy is: midl, Operation is:GetBindQQ
Ice::Long lQQ;
Ice::Context ctx;
ctx["User"] = "AA";
ctx["Password"] = "AA";
cResultPtr rt = midl->GetBindQQ(sTestMobile, 1, lQQ, ctx);
the server run in C++ environment on Linux.
but in Ice::Current only exist "User" and "Password", not exist "AA".
In other word, the second value of Ice::Context hasn't been transfered to server.
DEBUG: Password|
DEBUG: User|
The key "User" and "Password" are empty.
the proxy is: midl, Operation is:GetBindQQ
Ice::Long lQQ;
Ice::Context ctx;
ctx["User"] = "AA";
ctx["Password"] = "AA";
cResultPtr rt = midl->GetBindQQ(sTestMobile, 1, lQQ, ctx);
the server run in C++ environment on Linux.
but in Ice::Current only exist "User" and "Password", not exist "AA".
In other word, the second value of Ice::Context hasn't been transfered to server.
DEBUG: Password|
DEBUG: User|
The key "User" and "Password" are empty.
0
Comments
-
Note: the client is in VC++6.0 on windows
Note: the client is in VC++6.0 on windows0 -
Hi,
I'm afraid I'm unable to reproduce this problem. Could you post the code for you servant implementation as well? The best to investigate this would be to try to reproduce it with for example the demo/Ice/minimal demo and send us the test case.
Cheers,
Benoit.0 -
hello, the case is:benoit wrote:Hi,
I'm afraid I'm unable to reproduce this problem. Could you post the code for you servant implementation as well? The best to investigate this would be to try to reproduce it with for example the demo/Ice/minimal demo and send us the test case.
Cheers,
Benoit.
On Server In HelloI.cpp(the environment is C++ on Linux)
void
HelloI::sayHello(const Ice::Current&) const
{
for(Ice::Context::const_iterator it=curr.ctx.begin(); it!=curr.ctx.end(); ++it)
{
cout << "ctx:" << it->first << "|" << it->second << endl;
}
cout << "Hello World!" << endl;
}
On Client In Client.cpp(the environment is VC++6.0)
try
{
communicator = Ice::initialize(argc, argv);
HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
if(!hello)
{
cerr << argv[0] << ": invalid proxy" << endl;
status = EXIT_FAILURE;
}
else
{
Ice::Context ctx;
ctx["User"] = "AA";
ctx["Password"] = "BB";
hello->sayHello();
}
}
And the result is:
ctx:User|
ctx:Password|
Hello World!
as show above. The "ctx" part is only key not value.0 -
Hi,
You need to pass the context to the sayHello call if you don't set it on the proxy, for example:hello->sayHello(ctx);
Cheers,
Benoit.0 -
benoit wrote:Hi,
You need to pass the context to the sayHello call if you don't set it on the proxy, for example:hello->sayHello(ctx);
Cheers,
Benoit.
yes, I have passed the context to the sayhello and the method as you write.I forget write it, , otherwise the key can't be passed. But the result is I only get Key such as 'User' and don't get the value.0