Archived

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

A problem about struct of multi-items

Hi everyone!

I defined a struct in slice , like this:

sequence< string > TableList;
/*
说明:任务信息结构体,存储任务信息
*/
struct TaskOfInf
{
string TaskID;//
string TaskName;//
string TaskSort;//
string ResHostName;//
string ResHostIP;//
string DbName;//
string DesHostName;//
string DesHostIP;//
string BakPolicySort;//
string TaskBeginDate;//
string TaskState;//
string TaskDescribe;//
string BakType;//
string DbBakPath;//
TableList DbTables;//
};

There are 15 items in this struct,and i defined a interface to send it,now,it can work right!

this interface was defined in slice like this:

interface ManageToCenter
{
string WriteConfig( TaskOfInf tmpTask );
};


But,now i want to add a item in this struct and this struct has 16 items,like this:

sequence< string > TableList;
/*
说明:任务信息结构体,存储任务信息
*/
struct TaskOfInf
{
string TaskID;//
string TaskName;//
string TaskSort;//
string ResHostName;//
string ResHostIP;//
string DbName;//
string DesHostName;//
string DesHostIP;//
string BakPolicySort;//
string TaskBeginDate;//
string TaskState;//
string TaskDescribe;//
string BakType;//
string DbBakPath;//
TableList DbTables;//
string TaskDataCapacity;//i add a new item
};


and i could not work it right,when i invok WriteConfig in interface,my server throw a exception:

warning: dispatch exception: BasicStream.cpp:1369: Ice::UnmarshalOutOfBoundsException:
protocol error: out of bounds during unmarshaling



when i remove this item ,it can work right.....
i don't know how to solve it,please give me some suggest thanks!


PS:my client is: Vc++6.0 /windwos xp SP2
my server is: gcc3.0 /RH9 linux 2.4
ice's version :3.0.1

Comments

  • matthew
    matthew NL, Canada
    You are almost certainly using a different slice definition in the server -- hence the marshaling exception. The server is expecting one thing and you are sending another.
  • matthew wrote:
    You are almost certainly using a different slice definition in the server -- hence the marshaling exception. The server is expecting one thing and you are sending another.


    hi!
    i indeed check these slice in 'client' and 'server',i ensure they are the same.
  • Are you sure that, after making this change, you recompiled both client and server? As Matthew says, the unmarshaling error indicates that client and server are using mismatched Slice definitions.

    Cheers,

    Michi.
  • thanks to yours!

    i will try to check the slice file more careful.


    cheers!