0
阱接收經由ksoap2複雜DATAS在機器人,我有有一個方法發送和[在序列化錯誤]
- 接收MonitorRequest(序列化的對象)
- 返回MonitorResponse []的服務器(序列化對象)
- 每個MonitorResponse包含一個MonitorDetail,它具有我需要的信息。
代碼:
class MonitorDetail implements Serializable{
String name;
//Long, Short, String (...)
}
class MonitorResponse implements Serializable{
Short returnCode;
MonitorDetail monitorCodeList; //the request can request more than 1 monitor info.
String user;
}
class MonitorRequest implements Serializable {
Integer storeCode;
Short categoryCode;
Long[] monitorCodeList; //here I post the code of the monitors I need
String user;
//getters and setters
}
所以,這裏是我的問題: 我不能改變這些對象的定義在服務器中,所以我怎麼能 使這種溝通沒有得到「黑話連載錯誤'。
如何發送ProductRequest,接收ProductResponse []和 通過KSOAP2獲取特定的ProductDetail?
我已經試過:
SoapObject request = new SoapObject(NAMESPACE, OPERATION);
request.addProperty(PROPERTY, getProductConfiguredMonitorRequest());
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
enter code here
try {
httpTransport.call("", envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
return extractMonitorDetailFromResult(result);
} catch (Exception e) {
/* a lot of stuff */
return null;
}
return null;
這樣,我怎麼能做出這樣的溝通?