@Test public void generateJava() { String outputdir = "/home/boqi/git/jaxws/src/main/java/"; String wsdlfile = "/home/boqi/git/jaxws/src/main/java/bq/cxf/tutorial/simple2/server/wsdlfirst_echo.wsdl"; WSDLToJava.main(new String[] {"-impl", "-server", "-d", outputdir, wsdlfile}); outputdir = "/home/boqi/git/jaxws/src/test/java/"; WSDLToJava.main(new String[] {"-client", "-d", outputdir, wsdlfile}); }
@Override protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException { try { String type; String wsdlLocation; ServiceModel sm = new Wsdl4jModel(pathToWSDL); serviceName = sm.getServiceName(); targetNamespace = sm.getTargetNamespace(); serviceUrl = sm.getServiceUrl(); String impl = sm.getImplementorClass(); implementorName = impl.substring(0, impl.lastIndexOf('.') + 1) + capitalize(sm.getSoapPortType()); if (isConsumer) { type = "-client"; wsdlLocation = new File(pathToWSDL).toURI().toString(); } else { type = "-impl"; implementorName += "Impl"; wsdlLocation = ""; } if (serviceName == null) { throw new Exception(Messages.ERROR_NO_SERVICE_CLASSES); } WSDLToJava w2j = new WSDLToJava( new String[] { type, "-wsdlLocation", wsdlLocation, "-d", srcFolder.getLocation().toOSString(), pathToWSDL }); ToolContext context = new ToolContext(); w2j.run(context); newProject.refreshLocal(IResource.DEPTH_INFINITE, monitor); } catch (CoreException e) { throw e; } catch (Exception e) { throw new InvocationTargetException(e); } }
public static void main(String[] args) { WSDLToJava.main( new String[] { "-client", "-d", "src/main/java", "-p", "client.print.topdown", "http://localhost:8080/osmanvlastic/printServiceV2?wsdl" }); System.out.println("Done!"); }