日期:2014-05-17  浏览次数:20697 次

如何在自己的系统上(ERP,Java)调用别的网站上的webservice
详情:
我是用金蝶bos调用网站端的webservice

代码如何

Java code

protected boolean _getSaleSomeInfo(Context ctx, String object_key)
    throws BOSException {
        SaleOrderInfo saleOrderInfo =  getSaleOrder(ctx, object_key);
        logger.info("******调用方法成功*******"+saleOrderInfo.getSiteOrderNumber());
        boolean result = false;
        if(null!= saleOrderInfo){
            //预付款
            BigDecimal theUseOfAdvancePayment = saleOrderInfo.getTheUseOfAdvancePayment();
            theUseOfAdvancePayment = theUseOfAdvancePayment == null ? new BigDecimal("0") : theUseOfAdvancePayment;
            //发生
            BigDecimal divierAmount = saleOrderInfo.getDivierAmount();
            divierAmount = divierAmount == null ? new BigDecimal("0") : divierAmount;
            BigDecimal amountMoney = theUseOfAdvancePayment.subtract(divierAmount);
            amountMoney = amountMoney == null ? new BigDecimal("0") : amountMoney;
            String amount = amountMoney.toString();
             String data_json = "{orderId:'"+object_key+"',amount:'"+amount+"'}";
            //获取客户
            CustomerInfo customerInfo = saleOrderInfo.getOrderCustomer();
            String customerNumber= customerInfo.getNumber();
            logger.info("订单客户number********"+customerNumber);
            JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();  
            factory.setServiceClass(IWholesaleCheckBalanceWAS.class);
            factory.setAddress("http://115.236.180.114:701/services/wholesaleCheckBalanceWAS?wsdl");
            IWholesaleCheckBalanceWAS client = (IWholesaleCheckBalanceWAS) factory.create();  
            logger.info("调用client********"+client);
            System.out.println("=============+++++++"+client);
            String receive_result = client.execute("U001",compress(data_json),customerNumber); 
            if("true".equals(receive_result)){
                result = true;
                logger.info("调用全麦WSDL成功!"+saleOrderInfo.getSiteOrderNumber());
            }else{
                result = false;
                logger.info("调用全麦WSDL失败!"+saleOrderInfo.getSiteOrderNumber());
            }
        }
        return result;
}
    





导入的jar包




然后打断点走到这里报错 

java.lang.NoClassDefFoundError: org/apache/cxf/jaxws/JaxWsProxyFactoryBean




------解决方案--------------------
去apache网站下载完整的cxf的jar