【发布时间】:2014-04-29 08:42:10
【问题描述】:
public class MainActivity extends Activity {
private static final String SOAP_ACTION = "http://tempuri.org/xxxx/GetLatLong";
private static final String METHOD_NAME = "GetLatLong";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://xxxx:xxxx/xxxx.svc/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();
textView.setText(response.toString());
}
catch (Exception exception)
{
textView.setText(exception.toString());
}
}
}
这是我的代码示例。 这将返回一个带有 3 个数据描述 latitude 和 longitude 的字符串。
我想单独处理它们,我该如何管理? 然后我想把它放在具有该配置的地图上。
【问题讨论】:
-
请提供响应字符串..
-
[{"Description":"1","Latitude":0.369,"Longitude":1.258},{"Description":"2","Latitude":1.369,"Longitude": 3.258},{"描述":"3","纬度":2.369,"经度":4.258}]