webservice客户端工具

webservice客户端工具
    public static Object invokeWebService(String namespaces,String url, String method, Object[] params, Object[] paramNames) {
        Object result = null;
        
        try {
            Service service = new Service();
            Call call = (Call) service.createCall();
            call.setOperationName(new QName(namespaces, method));
            call.setTargetEndpointAddress(new java.net.URL(url));
            
            if (paramNames != null && paramNames.length > 0) {
                for (int i=0; i<paramNames.length; i++) {
                    String qName = paramNames[i].toString();
                    call.addParameter(qName , org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN);
                }
            }
            
            call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);
            call.setUseSOAPAction(true);
            call.setSOAPActionURI(url);
            //System.out.println("开始调用接口");
            result = call.invoke(params);
            //System.out.println("接口返回信息:"+result);
        } catch (Exception e) {
            e.printStackTrace();
            //System.out.println("*****[" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "][" + SendMsgClientService.class.getCanonicalName() + ".invokeWebService.RemoteException] 政务总线调用 AxisWebService 异常*****");
        }

        return result;
    }
webservice客户端工具

 

webservice客户端工具,布布扣,bubuko.com

webservice客户端工具

上一篇:MVC 增加统一异常处理机制


下一篇:webdynpro 下拉列表控件