View Single Post
  #1 (permalink)  
Old 04-02-2004
damingyipai damingyipai is offline
Registered User
 
 
Join Date: Jan 2004
Posts: 59
much like a Bug !

much like a Bug !

Slice:

module jf
{
module nation
{
struct UserMessage
{
string User;
string Pwd;
string Group;
string Session;
};

struct UserConn
{
long Id;
};

class Ftr
{
UserConn Good( int encoding, string usr, string pwd, string grp, string sn );
UserConn Bad( int encoding, UserMessage user );
};
};
};


Server side implement:

::jf::nation::UserConn FtrI::Good(
::Ice::Int encoding,
const ::std::string &usr,
const ::std::string &pwd,
const ::std::string &grp,
const ::std::string &sn,
const ::Ice::Current&)
{
::jf::nation::UserConn cn;
cn.Id = 0;
return cn;
}

::jf::nation::UserConn FtrI::Bad(
::Ice::Int encoding,
const ::jf::nation::UserMessage& usr
const ::Ice::Current&)
{
::jf::nation::UserConn cn;
cn.Id = 0;
return cn;
}

Php test code:

<?php
Ice_loadProfile();

try {

$ftr = $ICE->stringToProxy( "FTR:tcp -p 50000" );
$ftr = $ftr->ice_checkedCast( "::jf::nation::FTR" );

} catch( Ice_LocalException $ex ) {
print_r( $ex );
return;
}

try {

echo "this test will be passed...<br/>";
$cn = $ftr->Good( jf_gEncodingPhp, "", "", "", "" );

echo "this test will be failed...<br/>";
$um = new jf_nation_UserMessage;
$cn = $ftr->Bad( jf_gEncodingPhp, $um );

echo "test ok<br/>";
} catch( Ice_LocalException $ex ) {
print_r( $ex );
return;
} catch( jf_GenericError $ex ) {
print_r( $ex->reason );
return;
}
?>

run the test, then server side throw a exception:

FTR: warning: dispatch exception: ../../include\Ice/BasicStream.h:112: Ice::Unma
rshalOutOfBoundsException:
protocol error: out of bounds during unmarshaling
identity: FTR
facet:
operation: Bad

and php client side throw a exception:

Ice_UnknownLocalException Object
( [unknown] => ../../include\Ice/BasicStream.h:112: Ice::UnmarshalOutOfBoundsException: protocol error: out of bounds during

unmarshaling [message:protected] => [string:private] => [code:protected] => 0 [file:protected] =>

D:\temp\jetrocket\webroot\ftr_test.php [line:protected] => 29 [trace:private] => Array ( ) )
Attached Files
File Type: txt 1.txt (2.5 KB, 181 views)
Reply With Quote