发送到java webservice的序列化对象缺少属性

时间:2011-04-21 08:34:05

标签: java web-services serialization

我正在尝试将(自定义的)Message对象发送到(java)webservice。这个(可序列化的)Message对象有几个属性,其中一些属性不会到达另一端。 接收字符串和整数很好,但其他属性(如自定义对象)将被视为空。

例如,我有一个对象DBOBjectWrapper,它包含几个整数,字符串和一个DBObject。整个DBObjectWrapper类是可序列化的。使用此类对象作为属性撰写邮件并将其发送到Web服务时,DBObjectWrapper属性将作为null收到。

我没有丝毫不知道哪里出了问题......

编辑:消息类代码:

public class Message implements Serializable {

public static final int HEARTBEAT = 0;
public static final int DATA = 1;
public static final int USERINPUT = 2;
private static final long serialVersionUID = 4424864883768231974L;

private long DSId;
private int messageType;
private String sender;
private String receiver;
private DBObjectWrapper doc;
private String alert;
private ArrayList<Float> longitudes;
private ArrayList<Float> latitudes;
private ArrayList<Driver> drivers;
private ArrayList<Vehicle> vehicles;
private ArrayList<DBObjectWrapper> data;
private double total_km;
private double total_fuel_consumption;
private Date interval_start;
private Date interval_end;
private Password password;
private String username;
private Company 
public Message(){}

//..some getters and setters..

}

DBObjectWrapper代码:

public final class DBObjectWrapper implements Serializable {
private static final long serialVersionUID = -1808207325031069388L;

private BasicDBObject doc;
private String nosqlDBObjectId = null;
private String carId = null;
private long time = (int) 0;
private float GPS_longitude = (float) 0;
private float GPS_latitude = (float) 0;
private int Gyr_X_Peak = (int) 0;
private float Gyr_X_Avg = (float) 0;
private int Gyr_Y_Peak = (int) 0;
private float Gyr_Y_Avg = (float) 0;
private int Gyr_Z_Peak = (int) 0;
private float Gyr_Z_Avg = (float) 0;
private int CAN_speed = (int) 0;
private int CAN_Rpm = (int) 0;
private int Throttle_Position_Pct = (int) 0;

public DBObjectWrapper() {
    doc = new BasicDBObject();
}

//..some more constructors and getters/setters

}

提前致谢!

0 个答案:

没有答案
相关问题