org.apache.axis2.AxisFault: 服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。

y000n520 发布于 2014/05/16 15:19
阅读 3K+
收藏 0

java 调用。net webservices的时候 报上面那个错 求解答

代码如下:


private static String INNS100_URL="http://medium.100inns.com/PartnerService.asmx?wsdl";

private volatile static PartnerServiceStub client;

private final static Logger logger = LoggerFactory.getLogger(PartnerServiceStub.class);



public static PartnerServiceStub getClient() {

if (client == null) {

synchronized (PartnerServiceStub.class) {

if (client == null) {

try {

client = new PartnerServiceStub(INNS100_URL);

} catch (AxisFault e) {

logger.error("inns100 web service get client is error:[{}]", Tools.exceptionMsg(e));

}

}

}

}

return client;

}


public Map<String, List<HotelRoom>> hotelRatePlan(String beginDate,

String endDate, String hotelId, String rateType) {

// TODO Auto-generated method stub

try {

PartnerServiceStub client = getClient();


ServiceClient serviceClient = client._getServiceClient();

serviceClient.getOptions().setAction("http://tempuri.org/SearchHotelRates");

serviceClient.getOptions().setSoapVersionURI(

    org.apache.axis2.Constants.URI_SOAP11_ENV);


PartnerServiceStub.SearchHotelRates rateReq = new PartnerServiceStub.SearchHotelRates();

rateReq.setHotelID(hotelId);

if (endDate != null) {

rateReq.setCheckInDate(beginDate);

rateReq.setCheckOut(endDate);

} else {

rateReq.setCheckInDate(beginDate);

rateReq.setCheckOut(beginDate);

}

rateReq.setSearchType(rateType);

SearchHotelRatesResponse rateRes =client.searchHotelRates(rateReq);

System.out.println(rateRes.getSearchHotelRatesResult());

// if(rateRes.getSearchHotelRatesNewResult())


} catch (AxisFault e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (RemoteException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}


return null;

}


加载中
返回顶部
顶部