当前位置: 代码迷 >> Android >> 想做一个天气预报的应用,除了Google还有什么网址可以用xml解析的?解决思路
  详细解决方案

想做一个天气预报的应用,除了Google还有什么网址可以用xml解析的?解决思路

热度:63   发布时间:2016-05-01 21:15:48.0
想做一个天气预报的应用,除了Google还有什么网址可以用xml解析的??
RT

------解决方案--------------------
www.webxml.com.cn提供的有天气预报的webservice
------解决方案--------------------
Java code
    private static final String NAMESPACE = "http://WebXml.com.cn/";    private static String URL = "http://www.webxml.com.cn/webservices/weatherwebservice.asmx";    private static final String METHOD_NAME = "getWeatherbyCityName";    private static String SOAP_ACTION = "http://WebXml.com.cn/getWeatherbyCityName";    private SoapObject detail;    public void getWeather(final String cityName) {        try        {            SoapObject rpc = new SoapObject(NAMESPACE, METHOD_NAME);            rpc.addProperty("theCityName", cityName);            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);            envelope.bodyOut = rpc;            envelope.dotNet = true;            envelope.setOutputSoapObject(rpc);            HttpTransportSE ht = new HttpTransportSE(URL);            ht.debug = true;            ht.call(SOAP_ACTION, envelope);            detail =(SoapObject) envelope.getResponse();            Log.i("TAG","getWeather ");            GetData(detail,cityName);             return;        } catch (Exception e)         {            e.printStackTrace();        }    }
------解决方案--------------------
www.webxml.com.cn提供的天气预报webservice地址:
http://www.webxml.com.cn/webservices/weatherwebservice.asmx
这个地址可以直接调用了。
  相关解决方案