我在Java代码中使用了示例wsdl。当我尝试打印输出时,它仅返回包名称,如:
$('.menu a').click(function(){
$('.menu').hide();
});
仅当输出为列表时,这种情况才会发生。
部分代码:
com.holidaywebservice.holidayservice_v2.CountryCode@6b6478
wsdl网址:http://holidaywebservice.com/HolidayService_v2/HolidayService2.asmx?WSDL
答案 0 :(得分:0)
使用此com.holidaywebservice.holidayservice_v2.CountryCode@6b6478
,您正在尝试打印ArrayOfCountryCode
对象。您的代码应该是:
package com.holidaywebservice.holidayservice_v2.clientsample;
import com.holidaywebservice.holidayservice_v2.*;
public class ClientSample {
public static void main(String[] args) {
//Create Web Service Client..."
HolidayService2 service1 = new HolidayService2();
//Create Web Service...
HolidayService2HttpGet port1 = service1.getHolidayService2HttpGet();
//call WS
ArrayOfCountryCode acc = port1.getCountriesAvailable();
for(CountryCode cc : acc.getCountryCode()){
System.out.println("Country code is: " + cc.getCode());
System.out.println("Country code Description is: " + cc.getDescription());
}
}
}
更新尝试仅添加以下内容
for(CountryCode cc : acc.getCountryCode()){
System.out.println("Country code is: " + cc.getCode());
System.out.println("Country code Description is: " + cc.getDescription());
}
当前代码中ArrayOfCountryCode acc = hss1.getCountriesAvailable();
行之后。但是您会发现它的要旨,acc
是一组国家/地区代码。