首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

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

2012-05-16 
想做一个天气预报的应用,除了Google还有什么网址可以用xml解析的??RT[解决办法]www.webxml.com.cn提供的有

想做一个天气预报的应用,除了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
这个地址可以直接调用了。

热点排行