我開始編程在軸2(1.5)服務,像這樣:開始的Axis2服務編程
ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
AxisConfiguration cfg = context.getAxisConfiguration();
Map<String, MessageReceiver> mrMap = new HashMap<String, MessageReceiver>();
mrMap.put("http://www.w3.org/ns/wsdl/in-only", RPCInOnlyMessageReceiver.class.newInstance());
mrMap.put("http://www.w3.org/ns/wsdl/in-out", RPCMessageReceiver.class.newInstance());
AxisService service = AxisService.createService(MonitorWebService.class.getName(), cfg, mrMap, "", "http://samples", MonitorWebService.class.getClassLoader());
service.setScope("application");
cfg.addService(service);
SimpleHTTPServer server = new SimpleHTTPServer(context, 8080);
server.start();
通過這種設置,僅創建服務時,第一個操作請求到達 - 如何我可以強制軸立即構建服務嗎?我試過使用deployService(),而不是cfg.addService(),並立即啓動服務。我試過使用deployService()而不是cfg.addService()。但是,當第一個請求進入時,會創建另一個服務實例,所以這也不好。
使用這種方法我可以使用service.xml來配置服務? – 2011-12-27 14:32:03