有没有办法解析这个肥皂反应?
Is there any way to parse this soap response?
我的代码
protected void getComplaits(String Payroll_no) {
SoapObject request = new SoapObject(sd.NAMESPACE, sd.GET_COMPLAINTS_LIST);
PropertyInfo Payroll_info = new PropertyInfo();
Payroll_info.setName("Payroll_no");
Payroll_info.setValue(Payroll_no);
Payroll_info.setType(double.class);
request.addProperty(Payroll_info);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(sd.URL);
try {
androidHttpTransport.call(sd.GET_COMPLAINTS_LIST_SOAP_ACTION, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
result1 =result.toString();
} catch (Exception e) {
result1 = e.toString();
}
}
这是我的肥皂反应
Get_Complaints_listResponse
{Get_Complaints_listResult=anyType
{schema=anyType
{element=anyType
{complexType=anyType
{choice=anyType
{element=anyType
{complexType=anyType
{sequence=anyType
{element=anyType{}; element=anyType {}; element=anyType{}; element=anyType{};
};
};
};
};
};
};
};
diffgram=anyType
{DocumentElement=anyType
{
Complaints_list=anyType{
COMPLAINT_NO=5951113; COMPLAINT_TYPE=NSI; CONSUMER_TYPE=M; COMPLAINT_TIME=0500; };
Complaints_list=anyType{
COMPLAINT_NO=403730614; COMPLAINT_TYPE=VLF; CONSUMER_TYPE=M; COMPLAINT_TIME=2340; };
};
};
};
}
我应该如何获取只有 COMPLAINT_NO、COMPLAINT_TYPE、CONSUMER_TYPE、COMPLAINT_TIME 数据。
我已经尝试解析了,但是还是不行,请指导!!!
我应该如何从这个字段中获取数据,有没有提供这些方法来提取数据的库!!
我在阅读了几个 post 后找到了解决方案。谢谢,Stack overflow Members
try {
androidHttpTransport.call(sd.GET_COMPLAINTS_LIST_SOAP_ACTION, envelope);
SoapObject root = (SoapObject) envelope.bodyIn;
SoapObject t = (SoapObject)root.getProperty(0);
SoapObject t1 = (SoapObject)t.getProperty(1);
SoapObject t2 = (SoapObject)t1.getProperty(0);
for(int i = 0;i < t2.getPropertyCount();i++)
{
SoapObject Complaint_list = (SoapObject) t2.getProperty(i);
SoapPrimitive complaint_no = (SoapPrimitive)Complaint_list.getProperty(0);
SoapPrimitive complaint_type = (SoapPrimitive)Complaint_list.getProperty(1);
SoapPrimitive consumer_type = (SoapPrimitive)Complaint_list.getProperty(2);
SoapPrimitive complaint_time = (SoapPrimitive)Complaint_list.getProperty(3);
Log.i("complaint_no",complaint_no.toString());
Log.i("complaint_type",complaint_type.toString());
Log.i("consumer_type",consumer_type.toString());
Log.i("complaint_time",consumer_type.toString());
}
} catch (Exception e) {
result1 = e.toString();
}
我的代码
protected void getComplaits(String Payroll_no) {
SoapObject request = new SoapObject(sd.NAMESPACE, sd.GET_COMPLAINTS_LIST);
PropertyInfo Payroll_info = new PropertyInfo();
Payroll_info.setName("Payroll_no");
Payroll_info.setValue(Payroll_no);
Payroll_info.setType(double.class);
request.addProperty(Payroll_info);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(sd.URL);
try {
androidHttpTransport.call(sd.GET_COMPLAINTS_LIST_SOAP_ACTION, envelope);
SoapObject result = (SoapObject) envelope.bodyIn;
result1 =result.toString();
} catch (Exception e) {
result1 = e.toString();
}
}
这是我的肥皂反应
Get_Complaints_listResponse
{Get_Complaints_listResult=anyType
{schema=anyType
{element=anyType
{complexType=anyType
{choice=anyType
{element=anyType
{complexType=anyType
{sequence=anyType
{element=anyType{}; element=anyType {}; element=anyType{}; element=anyType{};
};
};
};
};
};
};
};
diffgram=anyType
{DocumentElement=anyType
{
Complaints_list=anyType{
COMPLAINT_NO=5951113; COMPLAINT_TYPE=NSI; CONSUMER_TYPE=M; COMPLAINT_TIME=0500; };
Complaints_list=anyType{
COMPLAINT_NO=403730614; COMPLAINT_TYPE=VLF; CONSUMER_TYPE=M; COMPLAINT_TIME=2340; };
};
};
};
}
我应该如何获取只有 COMPLAINT_NO、COMPLAINT_TYPE、CONSUMER_TYPE、COMPLAINT_TIME 数据。 我已经尝试解析了,但是还是不行,请指导!!!
我应该如何从这个字段中获取数据,有没有提供这些方法来提取数据的库!!
我在阅读了几个 post 后找到了解决方案。谢谢,Stack overflow Members
try {
androidHttpTransport.call(sd.GET_COMPLAINTS_LIST_SOAP_ACTION, envelope);
SoapObject root = (SoapObject) envelope.bodyIn;
SoapObject t = (SoapObject)root.getProperty(0);
SoapObject t1 = (SoapObject)t.getProperty(1);
SoapObject t2 = (SoapObject)t1.getProperty(0);
for(int i = 0;i < t2.getPropertyCount();i++)
{
SoapObject Complaint_list = (SoapObject) t2.getProperty(i);
SoapPrimitive complaint_no = (SoapPrimitive)Complaint_list.getProperty(0);
SoapPrimitive complaint_type = (SoapPrimitive)Complaint_list.getProperty(1);
SoapPrimitive consumer_type = (SoapPrimitive)Complaint_list.getProperty(2);
SoapPrimitive complaint_time = (SoapPrimitive)Complaint_list.getProperty(3);
Log.i("complaint_no",complaint_no.toString());
Log.i("complaint_type",complaint_type.toString());
Log.i("consumer_type",consumer_type.toString());
Log.i("complaint_time",consumer_type.toString());
}
} catch (Exception e) {
result1 = e.toString();
}