你好我正在尝试连接到webservice并检索一些我希望从webservice获取项目的数据,并单独处理它们,例如单独的descrition纬度和经度,如果我可以将它们放到数组中。
public class MainActivity extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/xxx/GetLatLong";
private static final String METHOD_NAME = "GetLatLong";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "//xxxx:xxx/xxxx/soap";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
TextView textView = new TextView(this);
setContentView(textView);
SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(URL);
try
{
httpTransport.call(SOAP_ACTION, envelope);
Object response = envelope.getResponse();
JSONArray array = new JSONArray(response);
for (int count = 0; count<array.length();count++){
JSONObject obj = array.getJSONObject(count);
String description = obj.getString("Descritpion");
String latidude = obj.getString("Latidute");
String longidute = obj.getString("longidute");
}
}
catch (Exception exception)
{
textView.setText(exception.toString());
}
}
}