首页 > 代码库 > 调用程序中的webservice

调用程序中的webservice

调用程序中的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