您好我是新手,我从未使用过SOAP服务,实际上该服务是由另一个人制作的,所以我不知道该服务,到目前为止我成功发送了一个Integer并得到了响应但我不知道如何处理复杂的物体所以请指导我.. 代码如下:
public String sendOrder(String METHOD_NAME) {
String RESPONSE = "";
try {
Date dateTime = (Date) Calendar.getInstance().getTime();
request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("ShopID", 0);
request.addProperty("SaleDate", getSOAPDateString(dateTime));
request.addProperty("UserID", 0);
request.addProperty("POSCode", "string");
request.addProperty("SaleID", 0);
request.addProperty("TableID", 0);
request.addProperty("TableDesc", "string");
request.addProperty("TableStatus", "");
SaleAndReturnDetailAndroid C = new SaleAndReturnDetailAndroid(0,0,1,0,false);
PropertyInfo pi = new PropertyInfo();
pi.setName("SaleAndReturnDetailAndroid");
pi.setValue(C);
pi.setType(C.getClass());
request.addProperty(pi);
//request.addProperty(pi);
//request.addProperty("LineItems", arrayList);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = request;
envelope.dotNet = true;
httpRequest = new HttpTransportSE(URL);
httpRequest.debug = true;
httpRequest.call(NAMESPACE + METHOD_NAME, envelope);
Log.v("Result ResPOnse", envelope.getResponse().toString());
RESPONSE = envelope.getResponse().toString();
Log.v("Result DONE", METHOD_NAME);
// GetData(RESPONSE, METHOD_NAME);
} catch (Exception e) {
Log.e("LINK_PARSER sendOrderInfo", e.toString());
}
return RESPONSE;
}
它给了我错误:
10-29 15:15:54.887: E/LINK_PARSER sendOrderInfo(18354): java.lang.RuntimeException: Cannot serialize: 0.0
SOAP服务是这样的:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<PlaceOrder xmlns="http://lumensoft.biz/">
<order>
<ShopID>int</ShopID>
<SaleDate>dateTime</SaleDate>
<UserID>int</UserID>
<POSCode>string</POSCode>
<SaleID>int</SaleID>
<TableID>int</TableID>
<TableDesc>string</TableDesc>
<TableStatus>string</TableStatus>
<LineItems>
<SaleAndReturnDetailAndroid>
<UnitPrice>double</UnitPrice>
<Qty>double</Qty>
<DishID>int</DishID>
<AvgCost>double</AvgCost>
<IsReturnItem>boolean</IsReturnItem>
</SaleAndReturnDetailAndroid>
<SaleAndReturnDetailAndroid>
<UnitPrice>double</UnitPrice>
<Qty>double</Qty>
<DishID>int</DishID>
<AvgCost>double</AvgCost>
<IsReturnItem>boolean</IsReturnItem>
</SaleAndReturnDetailAndroid>
</LineItems>
</order>
</PlaceOrder>
</soap:Body>
</soap:Envelope>
请原谅我的英语。
我不知道LineItems
是列表还是对象,
和SaleAndReturnDetailAndroid
是两次,所以我要送两次?
我想我做错了。
我真的很沮丧,请帮忙...