我正在通过netbeans IDE生成的Web服务客户端调用Web服务方法。从java中的soap响应中获取值
private String getCitiesByCountry(java.lang.String countryName) {
webService.GlobalWeatherSoap port = service.getGlobalWeatherSoap();
return port.getCitiesByCountry(countryName);
}
因此,我调用这个方法我的程序中,
String b = getWeather("Katunayake", "Sri Lanka");
,它会给我一个字符串输出包含XML数据。
String b = getWeather("Katunayake", "Sri Lanka"); = (java.lang.String) <?xml version="1.0" encoding="utf-16"?>
<CurrentWeather>
<Location>Katunayake, Sri Lanka (VCBI) 07-10N 079-53E 8M</Location>
<Time>Jun 22, 2015 - 06:10 AM EDT/2015.06.22 1010 UTC</Time>
<Wind> from the SW (220 degrees) at 10 MPH (9 KT):0</Wind>
<Visibility> greater than 7 mile(s):0</Visibility>
<SkyConditions> partly cloudy</SkyConditions>
<Temperature> 86 F (30 C)</Temperature>
<DewPoint> 77 F (25 C)</DewPoint>
<RelativeHumidity> 74%</RelativeHumidity>
<Pressure> 29.74 in. Hg (1007 hPa)</Pressure>
<Status>Success</Status>
</CurrentWeather>
我怎样才能得到<Location>,<SkyConditions>,<Temperature>
的价值。
我正在使用NetBeans IDE 7.3。当我使用getElementsByTagName(“”)它给我一个错误。 “找不到符号方法getElementsByTagName(String)” – dennypanther