You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by sa...@apache.org on 2011/08/22 14:41:36 UTC
svn commit: r1160240 - in /axis/axis2/java/core/trunk: ./ modules/codegen/
modules/codegen/src/org/apache/axis2/wsdl/
modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/
modules/codegen/src/org/apache/axis2/wsdl/util/
modules/codegen/test-resource...
Author: sagara
Date: Mon Aug 22 12:41:35 2011
New Revision: 1160240
URL: http://svn.apache.org/viewvc?rev=1160240&view=rev
Log:
Implemented JAX-WS processing for WSDL2JAVA and JAVA2WSDL tools.
In both tools once the "-jws' option available execution is redirect to Sun JAX-WS tools. Command line options can assign as follows.
1.) Possible to use options listed for Axis2 tools. ( e.g -o for out put directory etc.)
2.) Possible to use Sun JAX-WS tools options (e.g -verbose etc )
If a particular option label is used in both Axis2 tools and Sun tools , Axis2 tools get the priority.
Added:
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java (with props)
axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl (with props)
axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/
axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java (with props)
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java (with props)
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java (with props)
axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java (with props)
Modified:
axis/axis2/java/core/trunk/ (props changed)
axis/axis2/java/core/trunk/modules/codegen/pom.xml
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
axis/axis2/java/core/trunk/modules/distribution/pom.xml
axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
axis/axis2/java/core/trunk/modules/java2wsdl/pom.xml
axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java
axis/axis2/java/core/trunk/modules/parent/pom.xml
Propchange: axis/axis2/java/core/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Mon Aug 22 12:41:35 2011
@@ -2,3 +2,6 @@
*.iml
*.iws
target
+.metadata
+.settings
+debug
Modified: axis/axis2/java/core/trunk/modules/codegen/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/pom.xml?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/codegen/pom.xml Mon Aug 22 12:41:35 2011
@@ -53,6 +53,30 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Mon Aug 22 12:41:35 2011
@@ -19,9 +19,13 @@
package org.apache.axis2.wsdl;
+import java.util.Map;
+
+import org.apache.axis2.util.CommandLineOption;
import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.axis2.util.CommandLineOptionParser;
import org.apache.axis2.wsdl.codegen.CodeGenerationEngine;
+import org.apache.axis2.wsdl.codegen.jaxws.JAXWSCodeGenerationEngine;
import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.WSDL2JavaOptionsValidator;
@@ -31,6 +35,11 @@ public class WSDL2Code {
public static void main(String[] args) throws Exception {
CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
args);
+ //If it is a JAX-WS code generation request call WSimportTool.
+ if (isJwsOptionEnabled(commandLineOptionParser)){
+ new JAXWSCodeGenerationEngine(commandLineOptionParser, args).generate();
+ return;
+ }
if (isOptionsValid(commandLineOptionParser)){
new CodeGenerationEngine(commandLineOptionParser).generate();
} else {
@@ -59,5 +68,14 @@ public class WSDL2Code {
}
return isValid;
}
-
+
+ private static boolean isJwsOptionEnabled(CommandLineOptionParser parser) {
+ Map allOptions = parser.getAllOptions();
+ CommandLineOption option = (CommandLineOption) allOptions
+ .get(CommandLineOptionConstants.WSDL2JavaConstants.JAX_WS_SERVICE_OPTION);
+ if( option == null){
+ return false;
+ }
+ return true;
+ }
}
Added: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java (added)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java Mon Aug 22 12:41:35 2011
@@ -0,0 +1,245 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen.jaxws;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.axiom.om.util.LogOutputStream;
+import org.apache.axis2.util.CommandLineOption;
+import org.apache.axis2.util.CommandLineOptionConstants;
+import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.sun.tools.ws.wscompile.WsimportTool;
+
+/**
+ * The Class JAXWSCodeGenerationEngine.
+ */
+public class JAXWSCodeGenerationEngine {
+
+ private static final Log log = LogFactory
+ .getLog(JAXWSCodeGenerationEngine.class);
+
+ private CodeGenConfiguration configuration;
+ private CommandLineOptionParser commandLineOptionParser;
+ private String[] originalArgs;
+
+ /**
+ * Instantiates a new jAXWS code generation engine.
+ *
+ * @param configuration
+ * the configuration
+ * @param originalArgs
+ * the original args
+ * @throws CodeGenerationException
+ * the code generation exception
+ */
+ public JAXWSCodeGenerationEngine(CodeGenConfiguration configuration,
+ String[] originalArgs) throws CodeGenerationException {
+ this.configuration = configuration;
+ this.originalArgs = originalArgs;
+ // loadExtensions();
+ }
+
+ /**
+ * Instantiates a new jAXWS code generation engine.
+ *
+ * @param commandLineOptionParser
+ * the command line option parser
+ * @param originalArgs
+ * the original args
+ */
+ public JAXWSCodeGenerationEngine(
+ CommandLineOptionParser commandLineOptionParser,
+ String[] originalArgs) {
+ this.commandLineOptionParser = commandLineOptionParser;
+ this.originalArgs = originalArgs;
+ // loadExtensions();
+ }
+
+ /**
+ * Generate.
+ *
+ * @throws CodeGenerationException
+ * the code generation exception
+ */
+ public void generate() throws CodeGenerationException {
+
+ LogOutputStream logOutputStream = new LogOutputStream(log,
+ Integer.MAX_VALUE);
+ WsimportTool importTool = new WsimportTool(logOutputStream);
+ ArrayList<String> args = new ArrayList<String>();
+ configurImportToolOptions(args);
+ mergeOriginalArgs(args);
+ boolean success = importTool.run(args.toArray(new String[args.size()]));
+ if (success) {
+ log.info("Code generation completed");
+ }
+ }
+
+ /**
+ * Merge original args.
+ *
+ * @param args
+ * the args
+ */
+ private void mergeOriginalArgs(ArrayList<String> args) {
+ Map<String, CommandLineOption> allOptions = commandLineOptionParser
+ .getAllOptions();
+ List<String> axisOptionList = new ArrayList<String>();
+ List<String> originalArgsOps = new ArrayList<String>(
+ Arrays.asList(originalArgs));
+ originalArgsOps
+ .remove("-"
+ .concat(CommandLineOptionConstants.WSDL2JavaConstants.JAX_WS_SERVICE_OPTION));
+ originalArgsOps
+ .remove("-"
+ .concat(CommandLineOptionConstants.WSDL2JavaConstants.JAX_WS_SERVICE_OPTION_LONG));
+ Field[] allFields = CommandLineOptionConstants.WSDL2JavaConstants.class
+ .getFields();
+ Iterator<String> mapItr = allOptions.keySet().iterator();
+ for (Field field : allFields) {
+ if (String.class.equals(field.getType())) {
+ try {
+ axisOptionList
+ .add((String) field
+ .get(CommandLineOptionConstants.WSDL2JavaConstants.class));
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ while (mapItr.hasNext()) {
+ CommandLineOption op = allOptions.get(mapItr.next());
+ if (axisOptionList.contains(op.getOptionType())) {
+ if (op.getOptionType() != null) {
+ originalArgsOps.remove("-".concat(op.getOptionType()));
+ }
+ if (op.getOptionValue() != null) {
+ originalArgsOps.remove(op.getOptionValue());
+ }
+
+ }
+
+ }
+ args.addAll(originalArgsOps);
+ log.info("Original WSImport options" + Arrays.asList(originalArgsOps));
+ log.info("All WSImport options" + Arrays.asList(args));
+
+ }
+
+ /**
+ * Configur import tool options.
+ *
+ * @param args
+ * the args
+ */
+ private void configurImportToolOptions(ArrayList<String> args) {
+
+ Map allOptions = commandLineOptionParser.getAllOptions();
+ // Set some default options
+ args.add(WS_IMPORT_EXTENSION);
+ args.add(WS_IMPORT_NO_COMPILE);
+ args.add(WS_IMPORT_KEEP_FILE);
+
+ // Set some properties based on AXIS2 WSDL2JAVA options
+ String uri = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.WSDL_LOCATION_URI_OPTION);
+ if (uri != null) {
+ args.add(uri);
+ }
+
+ String location = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION);
+ if (location == null) {
+ location = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.OUTPUT_LOCATION_OPTION_LONG);
+ }
+ if (location != null) {
+ args.add(WS_IMPORT_FILE_OUTPUT_DIR);
+ args.add(location);
+ }
+
+ String pkg = getOptionValue(allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION);
+ if (pkg == null) {
+ pkg = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.PACKAGE_OPTION_LONG);
+ }
+ if (pkg != null) {
+ args.add(WS_IMPORT_PKG);
+ args.add(pkg);
+ }
+
+ String proxcyHost = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_HOST_OPTION_LONG);
+ String proxcyPort = getOptionValue(
+ allOptions,
+ CommandLineOptionConstants.WSDL2JavaConstants.HTTP_PROXY_PORT_OPTION_LONG);
+ if (pkg != null) {
+ args.add(WS_IMPORT_PROXY);
+ args.add(proxcyHost + ":" + proxcyPort);
+ }
+
+ }
+
+ /**
+ * Gets the option value.
+ *
+ * @param allOptions
+ * the all options
+ * @param optionName
+ * the option name
+ * @return the option value
+ */
+ private static String getOptionValue(Map allOptions, String optionName) {
+ CommandLineOption option = (CommandLineOption) allOptions
+ .get(optionName);
+ if (option != null) {
+ return option.getOptionValue().toString();
+ }
+ return null;
+ }
+
+ public static final String WS_IMPORT_EXTENSION = "-extension";
+ public static final String WS_IMPORT_NO_COMPILE = "-Xnocompile";
+ public static final String WS_IMPORT_FILE_OUTPUT_DIR = "-d";
+ public static final String WS_IMPORT_SOURCE_OUTPUT_DIR = "-s";
+ public static final String WS_IMPORT_KEEP_FILE = "-keep";
+ public static final String WS_IMPORT_PKG = "-p";
+ public static final String WS_IMPORT_PROXY = "-httpproxy";
+
+}
Propchange: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Mon Aug 22 12:41:35 2011
@@ -105,7 +105,9 @@ public class WSDL2JavaOptionsValidator i
WSDL2JavaConstants.USE_OPERATION_NAME.equalsIgnoreCase(optionType) ||
WSDL2JavaConstants.USE_OPERATION_NAME_LONG.equalsIgnoreCase(optionType) ||
XMLBeansExtension.XSDCONFIG_OPTION.equalsIgnoreCase(optionType) ||
- XMLBeansExtension.XSDCONFIG_OPTION_LONG.equalsIgnoreCase(optionType)
+ XMLBeansExtension.XSDCONFIG_OPTION_LONG.equalsIgnoreCase(optionType) ||
+ WSDL2JavaConstants.JAX_WS_SERVICE_OPTION.equalsIgnoreCase(optionType) ||
+ WSDL2JavaConstants.JAX_WS_SERVICE_OPTION_LONG.equalsIgnoreCase(optionType)
);
}
Added: axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl (added)
+++ axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl Mon Aug 22 12:41:35 2011
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:ns="http://sample" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://sample">
+ <wsdl:documentation>SimpleService</wsdl:documentation>
+ <wsdl:types>
+ <xs:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://sample">
+ <xs:element name="helloService">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="msg" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="helloServiceResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloServiceRequest">
+ <wsdl:part name="parameters" element="ns:helloService"/>
+ </wsdl:message>
+ <wsdl:message name="helloServiceResponse">
+ <wsdl:part name="parameters" element="ns:helloServiceResponse"/>
+ </wsdl:message>
+ <wsdl:portType name="SimpleServicePortType">
+ <wsdl:operation name="helloService">
+ <wsdl:input message="ns:helloServiceRequest" wsaw:Action="urn:helloService"/>
+ <wsdl:output message="ns:helloServiceResponse" wsaw:Action="urn:helloServiceResponse"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="SimpleServiceSoap11Binding" type="ns:SimpleServicePortType">
+ <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="helloService">
+ <soap:operation soapAction="urn:helloService" style="document"/>
+ <wsdl:input>
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SimpleServiceSoap12Binding" type="ns:SimpleServicePortType">
+ <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+ <wsdl:operation name="helloService">
+ <soap12:operation soapAction="urn:helloService" style="document"/>
+ <wsdl:input>
+ <soap12:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap12:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:binding name="SimpleServiceHttpBinding" type="ns:SimpleServicePortType">
+ <http:binding verb="POST"/>
+ <wsdl:operation name="helloService">
+ <http:operation location="helloService"/>
+ <wsdl:input>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:input>
+ <wsdl:output>
+ <mime:content type="text/xml" part="parameters"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="SimpleService">
+ <wsdl:port name="SimpleServiceHttpSoap11Endpoint" binding="ns:SimpleServiceSoap11Binding">
+ <soap:address location="http://localhost:8080/services/SimpleService.SimpleServiceHttpSoap11Endpoint/"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: axis/axis2/java/core/trunk/modules/codegen/test-resources/wsdls/SimpleService.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java (added)
+++ axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java Mon Aug 22 12:41:35 2011
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen.jaxws;
+
+import java.io.File;
+
+import org.apache.axis2.util.CommandLineOptionParser;
+import org.apache.axis2.wsdl.codegen.CodeGenerationException;
+
+import junit.framework.TestCase;
+
+/**
+ * The Class JAXWSCodeGenerationEngineTest.
+ */
+public class JAXWSCodeGenerationEngineTest extends TestCase {
+
+ final String filePath = "./target/sample";
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ File dir = new File(filePath);
+ assertEquals("Generated directory dtill exists ", false, dir.exists());
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+
+ super.tearDown();
+ File file = new File(filePath);
+ if (file.exists() && file.isDirectory()) {
+ for (File child : file.listFiles()) {
+ child.delete();
+ }
+ }
+ file.delete();
+ }
+
+ public void testGenerateWithMixOptions() throws CodeGenerationException {
+ String[] args = { "-jws", "-uri",
+ "test-resources/wsdls//SimpleService.wsdl", "-o", "./target" };
+ CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
+ args);
+ JAXWSCodeGenerationEngine engine = new JAXWSCodeGenerationEngine(
+ commandLineOptionParser, args);
+ engine.generate();
+ File dir = new File(filePath);
+ assertEquals("Generated directory does not exists ", true, dir.exists());
+ assertEquals("Generated directory does not exists ", true,
+ dir.isDirectory());
+ assertEquals("Incorrect number of generated files", 6,
+ dir.listFiles().length);
+ }
+
+ public void testGenerateWithAxisOptions() throws CodeGenerationException {
+ String[] args = { "-jws", "-uri",
+ "test-resources/wsdls//SimpleService.wsdl", "-o", "./target" };
+ CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
+ args);
+ JAXWSCodeGenerationEngine engine = new JAXWSCodeGenerationEngine(
+ commandLineOptionParser, args);
+ engine.generate();
+ File dir = new File(filePath);
+ assertEquals("Generated directory does not exists ", true, dir.exists());
+ assertEquals("Generated directory does not exists ", true,
+ dir.isDirectory());
+ assertEquals("Incorrect number of generated files", 6,
+ dir.listFiles().length);
+ }
+
+ public void testGenerateWithJAXWSOptions() throws CodeGenerationException {
+ String[] originalArgs = { "-jws", "-Xdebug", "-verbose",
+ "test-resources/wsdls/SimpleService.wsdl", "-d", "./target" };
+ String[] args = { "-jws" };
+ CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
+ args);
+ JAXWSCodeGenerationEngine engine = new JAXWSCodeGenerationEngine(
+ commandLineOptionParser, originalArgs);
+ engine.generate();
+ File dir = new File(filePath);
+ assertEquals("Generated directory does not exists ", true, dir.exists());
+ assertEquals("Generated directory does not exists ", true,
+ dir.isDirectory());
+ assertEquals("Incorrect number of generated files", 6,
+ dir.listFiles().length);
+ }
+
+}
Propchange: axis/axis2/java/core/trunk/modules/codegen/test/org/apache/axis2/wsdl/codegen/jaxws/JAXWSCodeGenerationEngineTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis2/java/core/trunk/modules/distribution/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/distribution/pom.xml?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/distribution/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/distribution/pom.xml Mon Aug 22 12:41:35 2011
@@ -228,6 +228,32 @@
<version>${project.version}</version>
<type>war</type>
</dependency>
+
+ <!-- These are needed to run JAX-WS tools -->
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.staxex</groupId>
+ <artifactId>stax-ex</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.stream.buffer</groupId>
+ <artifactId>streambuffer</artifactId>
+ <version>0.7</version>
+ </dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
<scm>
Modified: axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/bin-assembly.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/bin-assembly.xml?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/bin-assembly.xml (original)
+++ axis/axis2/java/core/trunk/modules/distribution/src/main/assembly/bin-assembly.xml Mon Aug 22 12:41:35 2011
@@ -178,6 +178,13 @@
<exclude>com.sun.xml.fastinfoset:FastInfoset:jar</exclude>
<exclude>rhino:js:jar</exclude>
<exclude>javax.servlet:servlet-api</exclude>
+ <exclude>javax.xml.ws:jaxws-api:jar</exclude>
+ <exclude>com.sun.xml.messaging.saaj:saaj-impl:jar</exclude>
+ <exclude>com.sun.xml.stream:sjsxp:jar</exclude>
+ <exclude>com.sun.org.apache.xml.internal:resolver:jar</exclude>
+ <exclude>javax.xml.stream:stax-api:jar</exclude>
+ <exclude>javax.xml.soap:saaj-api:jar</exclude>
+ <exclude>org.jvnet:mimepull:jar</exclude>
</excludes>
</dependencySet>
<dependencySet>
Modified: axis/axis2/java/core/trunk/modules/java2wsdl/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/pom.xml?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/pom.xml Mon Aug 22 12:41:35 2011
@@ -76,6 +76,30 @@
<artifactId>axis2-adb</artifactId>
<version>${project.version}</version>
<scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-xjc</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <scope>test</scope>
</dependency>
</dependencies>
<url>http://axis.apache.org/axis2/java/core/</url>
@@ -193,5 +217,25 @@
</executions>
</plugin>
</plugins>
- </build>
+ </build>
+ <profiles>
+ <profile>
+ <id>default-tools.jar</id>
+ <activation>
+ <property>
+ <name>java.vendor</name>
+ <value>Sun Microsystems Inc.</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>com.sun</groupId>
+ <artifactId>tools</artifactId>
+ <version>1.5</version>
+ <scope>system</scope>
+ <systemPath>${java.home}/../lib/tools.jar</systemPath>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
</project>
Modified: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java Mon Aug 22 12:41:35 2011
@@ -19,8 +19,14 @@
package org.apache.ws.java2wsdl;
+import java.util.Map;
+
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.axis2.util.CommandLineOptionConstants;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.ws.java2wsdl.jaxws.JAXWS2WSDLCodegenEngine;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser;
import org.apache.ws.java2wsdl.utils.Java2WSDLOptionsValidator;
@@ -30,6 +36,11 @@ public class Java2WSDL {
public static void main(String[] args) throws Exception {
Java2WSDLCommandLineOptionParser commandLineOptionParser = new Java2WSDLCommandLineOptionParser(
args);
+ if (isJwsOptionEnabled(commandLineOptionParser)){
+ JAXWS2WSDLCodegenEngine engine = new JAXWS2WSDLCodegenEngine(commandLineOptionParser.getAllOptions(), args);
+ engine.generate();
+ return;
+ }
// validate the arguments
validateCommandLineOptions(commandLineOptionParser);
Java2WSDLCodegenEngine engine = new Java2WSDLCodegenEngine(commandLineOptionParser.getAllOptions());
@@ -85,6 +96,16 @@ public class Java2WSDL {
}
}
+
+ private static boolean isJwsOptionEnabled(Java2WSDLCommandLineOptionParser parser) {
+ Map allOptions = parser.getAllOptions();
+ Java2WSDLCommandLineOption option = (Java2WSDLCommandLineOption) allOptions
+ .get(Java2WSDLConstants.JAX_WS_SERVICE_OPTION);
+ if( option == null){
+ return false;
+ }
+ return true;
+ }
}
Added: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java (added)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java Mon Aug 22 12:41:35 2011
@@ -0,0 +1,211 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ws.java2wsdl.jaxws;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.axiom.om.util.LogOutputStream;
+import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOption;
+
+import com.sun.tools.ws.wscompile.WsgenTool;
+
+/**
+ * The Class JAXWS2WSDLCodegenEngine.
+ */
+public class JAXWS2WSDLCodegenEngine {
+
+ /** The Constant log. */
+ private static final Log log = LogFactory
+ .getLog(JAXWS2WSDLCodegenEngine.class);
+
+ /** The options map. */
+ private Map<String, Java2WSDLCommandLineOption> optionsMap;
+
+ /** The original args. */
+ private String[] originalArgs;
+
+ /**
+ * Instantiates a new jAXW s2 wsdl codegen engine.
+ *
+ * @param optionsMap
+ * the options map
+ * @param originalArgs
+ * the original args
+ */
+ public JAXWS2WSDLCodegenEngine(
+ Map<String, Java2WSDLCommandLineOption> optionsMap,
+ String[] originalArgs) {
+ this.optionsMap = optionsMap;
+ this.originalArgs = originalArgs;
+ }
+
+ /**
+ * Generate.
+ *
+ * @throws Exception
+ * the exception
+ */
+ public void generate() throws Exception {
+ LogOutputStream logOutputStream = new LogOutputStream(log,
+ Integer.MAX_VALUE);
+ WsgenTool genTool = new WsgenTool(logOutputStream);
+
+ List<String> args = new ArrayList<String>();
+ configurImportToolOptions(args);
+ mergeOriginalArgs(args);
+ boolean success = genTool.run(args.toArray(new String[args.size()]));
+ if (success) {
+ log.info("Code generation completed");
+ }
+
+ }
+
+ /**
+ * Configur import tool options.
+ *
+ * @param args
+ * the args
+ */
+ private void configurImportToolOptions(List<String> args) {
+
+ // Set some default options
+ args.add(WS_GEN_EXTENSION);
+ args.add(WS_GEN_NO_COMPILE);
+ args.add(WS_GEN_KEEP_FILE);
+ args.add(WS_GEN_WSDL);
+
+ // Set some properties based on AXIS2 JAVA2WSDL options
+ String location = getOptionValue(optionsMap,
+ Java2WSDLConstants.OUTPUT_LOCATION_OPTION);
+ if (location == null) {
+ location = getOptionValue(optionsMap,
+ Java2WSDLConstants.OUTPUT_LOCATION_OPTION_LONG);
+ }
+ if (location != null) {
+ args.add(WS_GEN_FILE_OUTPUT_DIR);
+ args.add(location);
+ }
+
+ String classPath = getOptionValue(optionsMap,
+ Java2WSDLConstants.CLASSPATH_OPTION);
+ if (classPath == null) {
+ classPath = getOptionValue(optionsMap,
+ Java2WSDLConstants.CLASSPATH_OPTION_LONG);
+ }
+ if (classPath != null) {
+ args.add(WS_GEN_CLASSPATH);
+ args.add(classPath);
+ }
+
+ String className = getOptionValue(optionsMap,
+ Java2WSDLConstants.CLASSNAME_OPTION);
+ if (className == null) {
+ className = getOptionValue(optionsMap,
+ Java2WSDLConstants.CLASSNAME_OPTION_LONG);
+ }
+ if (className != null) {
+ args.add(className);
+ }
+
+ }
+
+ /**
+ * Merge original args.
+ *
+ * @param args
+ * the args
+ */
+ private void mergeOriginalArgs(List<String> args) {
+
+ List<String> axisOptionList = new ArrayList<String>();
+ List<String> originalArgsOps = new ArrayList<String>(
+ Arrays.asList(originalArgs));
+ originalArgsOps.remove("-"
+ .concat(Java2WSDLConstants.JAX_WS_SERVICE_OPTION));
+ originalArgsOps.remove("-"
+ .concat(Java2WSDLConstants.JAX_WS_SERVICE_OPTION_LONG));
+ Field[] allFields = Java2WSDLConstants.class.getFields();
+ Iterator<String> mapItr = optionsMap.keySet().iterator();
+ for (Field field : allFields) {
+ if (String.class.equals(field.getType())) {
+ try {
+ axisOptionList.add((String) field
+ .get(Java2WSDLConstants.class));
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ while (mapItr.hasNext()) {
+ Java2WSDLCommandLineOption op = optionsMap.get(mapItr.next());
+ if (axisOptionList.contains(op.getOptionType())) {
+ if (op.getOptionType() != null) {
+ originalArgsOps.remove("-".concat(op.getOptionType()));
+ }
+ if (op.getOptionValue() != null) {
+ originalArgsOps.remove(op.getOptionValue());
+ }
+
+ }
+
+ }
+ args.addAll(originalArgsOps);
+ log.debug("Original WSImport options" + Arrays.asList(originalArgsOps));
+ log.debug("All WSImport options" + Arrays.asList(args));
+
+ }
+
+ /**
+ * Gets the option value.
+ *
+ * @param allOptions
+ * the all options
+ * @param optionName
+ * the option name
+ * @return the option value
+ */
+ private static String getOptionValue(Map allOptions, String optionName) {
+ Java2WSDLCommandLineOption option = (Java2WSDLCommandLineOption) allOptions
+ .get(optionName);
+ if (option != null) {
+ return option.getOptionValue().toString();
+ }
+ return null;
+ }
+
+ public static final String WS_GEN_FILE_OUTPUT_DIR = "-d";
+ public static final String WS_GEN_CLASSPATH = "-cp";
+ public static final String WS_GEN_KEEP_FILE = "-keep";
+ public static final String WS_GEN_WSDL = "-wsdl";
+ public static final String WS_GEN_EXTENSION = "-extension";
+ public static final String WS_GEN_NO_COMPILE = "-Xnocompile";
+
+}
Propchange: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngine.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java (added)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java Mon Aug 22 12:41:35 2011
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ws.java2wsdl.jaxws;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.apache.ws.java2wsdl.utils.Java2WSDLCommandLineOptionParser;
+
+public class JAXWS2WSDLCodegenEngineTest extends TestCase {
+
+ final String filePath = "./target/";
+
+ public void gsetUp() throws Exception {
+ super.setUp();
+ File dir = new File(
+ filePath.concat("org/apache/ws/java2wsdl/jaxws/jaxws"));
+ File wsdl = new File(filePath.concat("ServerInfoService.wsdl"));
+ assertEquals("Generated directory still exists ", false, dir.exists());
+ assertEquals("Generated WSDL file still exists ", false, wsdl.exists());
+ }
+
+ public void tearDown() throws Exception {
+ super.tearDown();
+ String path = "org/apache/ws/java2wsdl/jaxws/jaxws";
+ File file = new File(filePath.concat(path));
+ if (file.exists() && file.isDirectory()) {
+ for (File child : file.listFiles()) {
+ child.delete();
+ }
+ }
+ file.delete();
+
+ int idx = path.lastIndexOf("/");
+ while (idx > 0) {
+ path = path.substring(0, idx);
+ idx = path.lastIndexOf("/");
+ file = new File(filePath.concat(path));
+ file.delete();
+ }
+ }
+
+ public void testGenerateWithMixOptions() throws Exception {
+ String[] args = { "-jws", "-verbose", "-cp", "target/test-classes",
+ "-cn", "org.apache.ws.java2wsdl.jaxws.ServerInfo", "-o",
+ "./target" };
+ Java2WSDLCommandLineOptionParser commandLineOptionParser = new Java2WSDLCommandLineOptionParser(
+ args);
+ JAXWS2WSDLCodegenEngine engine = new JAXWS2WSDLCodegenEngine(
+ commandLineOptionParser.getAllOptions(), args);
+ engine.generate();
+ verifyGeneration();
+ }
+
+ public void testGenerateWithAxisOptions() throws Exception {
+ String[] args = { "-jws", "-cp", "target/test-classes", "-cn",
+ "org.apache.ws.java2wsdl.jaxws.ServerInfo", "-o", "./target" };
+ Java2WSDLCommandLineOptionParser commandLineOptionParser = new Java2WSDLCommandLineOptionParser(
+ args);
+ JAXWS2WSDLCodegenEngine engine = new JAXWS2WSDLCodegenEngine(
+ commandLineOptionParser.getAllOptions(), args);
+ engine.generate();
+ verifyGeneration();
+ }
+
+ public void testGenerateWithJAXWSOptions() throws Exception {
+ String[] args = { "-jws", "-cp", "target/test-classes", "-cn",
+ "org.apache.ws.java2wsdl.jaxws.ServerInfo", "-d", "./target" };
+ Java2WSDLCommandLineOptionParser commandLineOptionParser = new Java2WSDLCommandLineOptionParser(
+ args);
+ JAXWS2WSDLCodegenEngine engine = new JAXWS2WSDLCodegenEngine(
+ commandLineOptionParser.getAllOptions(), args);
+ engine.generate();
+ verifyGeneration();
+ }
+
+ private void verifyGeneration() {
+ File dir = new File(
+ filePath.concat("/org/apache/ws/java2wsdl/jaxws/jaxws"));
+ assertEquals("Generated directory does not exists ", true, dir.exists());
+ assertEquals("Generated directory does not exists ", true,
+ dir.isDirectory());
+ /*
+ * Since we use -Xnocompile there should be only 2 files but due to a a
+ * exception current version doesn't support for this. Refer
+ * http://java.net/jira/browse/JAX_WS-360
+ */
+ assertEquals("Incorrect number of generated files", 4,
+ dir.listFiles().length);
+ File wsdl = new File(filePath.concat("ServerInfoService.wsdl"));
+ assertEquals("Generated WSDL file does not exists ", true,
+ wsdl.exists());
+ wsdl.delete();
+
+ }
+
+}
Propchange: axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/JAXWS2WSDLCodegenEngineTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java?rev=1160240&view=auto
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java (added)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java Mon Aug 22 12:41:35 2011
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.ws.java2wsdl.jaxws;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+@WebService
+public class ServerInfo {
+
+ @WebMethod
+ public String getIpAddress() {
+
+ return "10.10.10.10";
+
+ }
+
+}
\ No newline at end of file
Propchange: axis/axis2/java/core/trunk/modules/java2wsdl/test/org/apache/ws/java2wsdl/jaxws/ServerInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java Mon Aug 22 12:41:35 2011
@@ -167,4 +167,6 @@ public interface Java2WSDLConstants {
String WSDL_VERSION_2_OPTIONAL = "2";
String WSDL_VERSION_1 = "1.1";
String PARAMETERS = "parameters";
+ String JAX_WS_SERVICE_OPTION = "jws";
+ String JAX_WS_SERVICE_OPTION_LONG = "jax_ws_service";
}
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java Mon Aug 22 12:41:35 2011
@@ -99,6 +99,8 @@ public interface CommandLineOptionConsta
String WSDL_VERSION_2 = "2.0";
String WSDL_VERSION_2_OPTIONAL = "2";
String WSDL_VERSION_1 = "1.1";
+ String JAX_WS_SERVICE_OPTION = "jws";
+ String JAX_WS_SERVICE_OPTION_LONG = "jax_ws_service";
}
interface ExtensionArguments {
Modified: axis/axis2/java/core/trunk/modules/parent/pom.xml
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/parent/pom.xml?rev=1160240&r1=1160239&r2=1160240&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/parent/pom.xml (original)
+++ axis/axis2/java/core/trunk/modules/parent/pom.xml Mon Aug 22 12:41:35 2011
@@ -125,6 +125,8 @@
<failIfNoTests>false</failIfNoTests>
<m2Repository>'${settings.localRepository}'</m2Repository>
<geronimo-spec.jta.version>1.1</geronimo-spec.jta.version>
+ <jaxws.tools.version>2.1.3</jaxws.tools.version>
+ <jaxws.rt.version>2.1.3</jaxws.rt.version>
</properties>
<mailingLists>
<mailingList>
@@ -528,6 +530,16 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-tools</artifactId>
+ <version>${jaxws.tools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.ws</groupId>
+ <artifactId>jaxws-rt</artifactId>
+ <version>${jaxws.rt.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>