我试图在Android上通过ksoap2发出一个soap请求,而我正在收到一个说“"读取XMLStreamReader时出错的”的故障。"我不确定导致这种情况的原因,我会尽可能多地提供有关我们使用的信息,但有些内容是保密的。无论如何,我们真的想让这件事活起来。任何建议都会很棒。抛出错误(SoapObject)env.getResponse();
try
{
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope env = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject internalObject = new SoapObject(NAMESPACE, "groupId");
PropertyInfo props = new PropertyInfo();
props.setName("groupId");
props.setValue("omitted");
props.setType(String.class);
internalObject.addAttribute("groupId", "omitted");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"password");
props = new PropertyInfo();
props.setName("password");
props.setValue("omitted");
props.setType(String.class);
internalObject.addAttribute("password", "omitted");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"userId");
props = new PropertyInfo();
props.setName("userId");
props.setValue("omitted");
props.setType(String.class);
internalObject.addAttribute("userId", "omitted");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"xml");
String xmlFile = InspectDataDriver.buildXml();
props = new PropertyInfo();
props.setName("xml");
props.setValue("<! [CDATA [" + omitted.buildXml() + "]]");
props.setType(String.class);
internalObject.addAttribute("xml", "<! [CDATA [" + xmlFile + "]]" );
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"agentId");
props = new PropertyInfo();
props.setName("agentId");
props.setValue("omitted");
props.setType(String.class);
internalObject.addAttribute("agentId", "omitted" );
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"agentGroupId");
props = new PropertyInfo();
props.setName("agentGroupId");
props.setValue("omitted");
props.setType(String.class);
internalObject.addAttribute("agentGroupId", "omitted" );
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"reportFormat");
props = new PropertyInfo();
props.setName("reportFormat");
props.setValue("XML");
props.setType(String.class);
internalObject.addAttribute("reportFormat", "XML" );
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"reportFormat");
props = new PropertyInfo();
props.setName("detailedReport");
props.setValue("NO");
props.setType(String.class);
internalObject.addAttribute("detailedReport", "NO");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"valuationId");
props = new PropertyInfo();
props.setName("valuationId");
props.setValue("999999");
props.setType(String.class);
internalObject.addAttribute("valuationId", "999999");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
internalObject = new SoapObject(NAMESPACE,"version");
props = new PropertyInfo();
props.setName("version");
props.setValue("1");
props.setType(String.class);
internalObject.addAttribute("version", "1");
internalObject.addProperty(props);
request.addSoapObject(internalObject);
env.setOutputSoapObject(request);
env.dotNet = false;
env.encodingStyle = SoapSerializationEnvelope.XSD;
HttpTransportSE ht = new HttpTransportSE(URL);
ht.debug = true;
ht.call(SOAP_ACTION, env);
final SoapObject response = (SoapObject)env.getResponse();
final String str = ht.responseDump;
runOnUiThread(new Runnable()
{
@Override
public void run()
{
AlertDialog.Builder mBuild = new AlertDialog.Builder(ItemListActivity.this);
mBuild.setMessage(str);
AlertDialog mDialog = mBuild.create();
mDialog.show();
}
});
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
};