我有这个结构。它是一个带有项目列表的简单结构。
<soap:Body>
<SendPositions xmlns="http://tempuri.org/">
<username>string</username>
<password>string</password>
<loc>
<Pos>
<Lat>double</Lat>
<Lon>double</Lon>
<ts>dateTime</ts>
</Pos>
<Pos>
<Lat>double</Lat>
<Lon>double</Lon>
<ts>dateTime</ts>
</Pos>
</loc>
</SendPositions>
我尝试发送请求,但我一直收到错误。
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("username", zG.getID());
Request.addProperty("password", zG.getPIN());
SoapObject locations = new SoapObject(NAMESPACE, "loc");
for (Pos pozycja : zG.getListPositions())
{
SoapObject pos = new SoapObject(NAMESPACE, "Pos");
pos.addProperty("Lat", pozycja.getLat() + "");
pos.addProperty("Lon", pozycja.getLon() + "");
pos.addProperty("ts", pozycja.getDate()); // datetime yyyy-MM-dd HH:mm:ss.SSS
locations.addSoapObject(pos);
}
Request.addSoapObject(locations);
Log.i("Request", Request.toString());
我仍然认为问题是序列化数据。所以我使用这段代码:
MarshalDouble md = new MarshalDouble();
md.register(soapEnvelope);
我的日志(代码中的最后一行)
SendPositions{username=50000000; password=11111111111; loc{Pos{Lat=52.0; Lon=20.0; ts=2013-08-08 23:45:39.378; }Pos{Lat=52.0; Lon=20.0; ts=2013-08-08 23:46:04.416; }}}
我的错误是:
HTTP request failed, HTTP status: 500 - HTTP request failed, HTTP status: 500
不幸的是,我无法更改设置服务器...
您知道我做错了什么吗?
谢谢!