// TODO remove double factory lookup when removing the Wise override (in wise-core-cxf) of the // JBossWS WSConsumer // this is currently required to workaround classloading issues on flat classpath env (the jbossws // provided META-INF prop // might come before the wise one, so we use a different wise specific prop) private WSContractConsumer newWSContractConsumerInstance() { WSContractConsumerFactory factory = (WSContractConsumerFactory) ServiceLoader.loadService("org.jboss.wise.ConsumerFactory", null); if (factory != null) { return factory.createConsumer(); } else { return WSContractConsumer.newInstance(getContextClassLoader()); } }
@Override public synchronized List<String> importObjectFromWsdl( String wsdlURL, File outputDir, File sourceDir, String targetPackage, List<File> bindingFiles, PrintStream messageStream, File catelog) throws MalformedURLException, WiseRuntimeException { WSContractConsumer wsImporter = newWSContractConsumerInstance(); if (targetPackage != null && targetPackage.trim().length() > 0) { wsImporter.setTargetPackage(targetPackage); } wsImporter.setGenerateSource(this.isKeepSource()); wsImporter.setOutputDirectory(outputDir); wsImporter.setSourceDirectory(sourceDir); if (this.isVerbose()) { wsImporter.setMessageStream(System.out); } if (messageStream != null) { wsImporter.setMessageStream(messageStream); } if (bindingFiles != null && bindingFiles.size() > 0) { wsImporter.setBindingFiles(bindingFiles); } if (catelog != null) { wsImporter.setCatalog(catelog); } wsImporter.setTarget("2.1"); // workaround for WISE-179 runWSConsume(wsImporter, wsdlURL); return this.getClassNames(outputDir, targetPackage); }
@Override public void doGet(HttpServletRequest theRequest, HttpServletResponse theResponse) throws IOException { PrintWriter pw = theResponse.getWriter(); String jbwsVersion = WSContractConsumer.newInstance().getClass().getPackage().getImplementationVersion(); if (jbwsVersion.startsWith("4.0") || jbwsVersion.startsWith("4.1.0") || jbwsVersion.startsWith("4.1.1")) { pw.print( "[FIXME][JBWS-3589] This test is meant to be run properly on JBossWS 4.1.2.Final or greater"); } else { String name = theRequest.getParameter("name"); pw.print("WS return: " + invokeWS(name)); } }
protected void runWSConsume(WSContractConsumer wsImporter, String wsdlURL) throws MalformedURLException { wsImporter.consume(wsdlURL); }