このコード テンプレートは次のように使用できます。
public ArrayList<PhongTro> getPhongTros() {
ArrayList<PhongTro> arrPhongTro = new ArrayList<PhongTro>();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
/** contains all arrPhongTro objects */
SoapObject response = (SoapObject) envelope.getResponse();
/** lists property count */
final int intPropertyCount = response.getPropertyCount();
/** loop */
for (int i = 0; i < intPropertyCount; i++) {
/** temp SoapObject */
SoapObject responseChild = (SoapObject) response.getProperty(i);
/** temp PhongTro object */
PhongTro tempObj = new PhongTro();
if (responseChild.hasProperty("att0")) {
tempObj.setAtt0(responseChild.getPropertyAsString("att0"));
}
if (responseChild.hasProperty("att1")) {
tempObj.setAtt1(responseChild.getPropertyAsString("att1"));
}
if (responseChild.hasProperty("att2")) {
tempObj.setAtt2(responseChild.getPropertyAsString("att2"));
}
if (responseChild.hasProperty("att3")) {
tempObj.setAtt3(responseChild.getPropertyAsString("att3"));
}
if (responseChild.hasProperty("att4")) {
tempObj.setAtt4(responseChild.getPropertyAsString("att4"));
}
/** Adding temp PhongTro object to list */
arrPhongTro.add(tempObj);
}
} catch (Exception e) {
e.printStackTrace();
/** if an error handled arrPhongTro setting null */
arrPhongTro = null;
}
/** returning list */
return arrPhongTro;
}