1. 程式人生 > >調用程序中的webservice

調用程序中的webservice

println medical rec sta ogg except exceptio logs execute

調用程序中的webservice

public void manualExecuteCollect(String searchID, String tableName) {
     Properties properties = PropertiesUtils.getProperties("config.properties");
        String serviceUrl = properties.getProperty("webservice.url");
        ServiceClient sender = null;
        String wsURL = serviceUrl + "/webServices/nhfpcHandCollectionWs?wsdl";
        
try { EndpointReference endpoint = new EndpointReference(wsURL); Options options = new Options(); options.setTo(endpoint); options.setProperty(HTTPConstants.CHUNKED, "false");//設置不受限制. sender = new ServiceClient(); sender.setOptions(options); OMFactory fac
= OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace("http://webservice.nhfpc.acquisition.goodwill.com/", ""); OMElement method = fac.createOMElement("nhfpcMedicalServiceHandCollection", omNs); OMElement tableNameParamater = fac.createOMElement("tableName", omNs);//
設置入參名稱 tableNameParamater.setText(tableName);// 設置入參值 method.addChild(tableNameParamater); OMElement searchIDParameter = fac.createOMElement("pid", omNs);// 設置入參名稱 searchIDParameter.setText(searchID);// 設置入參值 method.addChild(searchIDParameter); method.build(); sender.sendReceive(method); // OMElement elementReturn = response.getFirstElement(); // String result = elementReturn.getText(); // System.out.println(result); } catch (Exception e) { logger.error("調用手動執行webservice方法出錯。" + e.getMessage(), e); throw new ApplicationException("手動執行數據采集出錯,請聯系管理員。"); } }

調用程序中的webservice