RT

解决方案 »

  1.   

    www.webxml.com.cn提供的有天气预报的webservice
      

  2.   


    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();
    } }
      

  3.   

    /*
     * String(0) 到 String(4):省份,城市,城市代码,城市图片名称,最后更新时间。
     * String(5) 到 String(11):当天的 气温,概况,风向和风力,天气趋势开始图片名称(以下称:图标一),天气趋势结束图片名称(以下称:图标二),现在的天气实况,天气和生活指数。
     * String(12) 到 String(16):第二天的 气温,概况,风向和风力,图标一,图标二。
     * String(17) 到 String(21):第三天的 气温,概况,风向和风力,图标一,图标二。
     * String(22) 被查询的城市或地区的介绍
     */
      

  4.   

    www.webxml.com.cn提供的天气预报webservice地址:
    http://www.webxml.com.cn/webservices/weatherwebservice.asmx
    这个地址可以直接调用了。