用于android大写的ksoap2抛出异常

时间:2011-11-10 16:59:21

标签: android xml ksoap2

我正在尝试使用kso​​ap2,但似乎大写soap对象的名称会引发异常。代码示例和它抛出的异常如下。

奇怪的是,当我检查ht.responseDump时,数据确实从服务器返回

提前致谢!

SoapObject foo = new SoapObject(NAMESPACE1, "foo");
SoapObject bar = new SoapObject(NAMESPACE1, "bar");
SoapObject search = new SoapObject(NAMESPACE1, "search");
SoapObject keywords = new SoapObject(NAMESPACE2, "Keywords"); //spelling this at 'keywords' is fine

search.addSoapObject(keywords);
bar.addSoapObject(search);
foo.addSoapObject(bar);

SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = foo ;
envelope.setAddAdornments(false);

HttpTransportSE ht = new HttpTransportSE("http://foo.bar/service");
ht.debug = true;
ht.call(null, envelope);
//returns the correct data, but throws an XmlPullParserException exception
//unexpected type (position:TEXT
//https://www.trus...@1:1327 in java.io.InputStreamReader@44eddd48) 

1 个答案:

答案 0 :(得分:0)

我想也许是因为你没有收到回复(调用getResponse方法)。