【发布时间】:2013-02-03 13:43:36
【问题描述】:
我正在使用 ksaop2-android 生成我的网络服务, 这是我使用的 wsdl:http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL
这是我的代码:
String serviceUrl = "http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL";
String methodName = "GetCityWeatherByZIP";
SoapObject request = new SoapObject("http://ws.cdyne.com/WeatherWS/",
methodName);
request.addProperty("ZIP", "64101");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER12);
envelope.dotNet = false;
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(serviceUrl);
try {
ht.call("http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP", envelope);
if (envelope.getResponse() != null) {
SoapObject soapObject = (SoapObject) envelope.getResponse();
System.out.println(soapObject.getProperty("ResponseText"));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (XmlPullParserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
我可以通过这个网址得到正确的回复: http://wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP?ZIP=64101
但是,我的代码给了我这样的响应:
在我们的天气数据中找不到城市。请联系 CDYNE 了解更多详情。
参数好像没有发送,可能是哪一部分出错了?
【问题讨论】:
标签: android web-services wsdl ksoap2