Author: mmao
Date: Tue Mar 6 03:21:21 2007
New Revision: 515077
URL: http://svn.apache.org/viewvc?view=rev&rev=515077
Log:
CXF-449
In java first approach the localName of the wrapper annotations should be
ignored
fixed for both tools and tools2
Added:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
Modified:
incubator/cxf/trunk/tools/java2wsdl/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/DocWrapperMethodProcessor.java
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/jaxws/WSDLGenerator.java
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/WrapperUtil.java
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
Modified:
incubator/cxf/trunk/tools/java2wsdl/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/DocWrapperMethodProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/DocWrapperMethodProcessor.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/DocWrapperMethodProcessor.java
(original)
+++
incubator/cxf/trunk/tools/java2wsdl/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/DocWrapperMethodProcessor.java
Tue Mar 6 03:21:21 2007
@@ -80,8 +80,6 @@
String reqNS = model.getTargetNameSpace();
if (reqWrapper != null &&
!StringUtils.isEmpty(reqWrapper.className())) {
reqClassName = reqWrapper.className().length() > 0 ?
reqWrapper.className() : reqClassName;
- reqName = reqWrapper.localName().length() > 0 ?
reqWrapper.localName() : reqName;
- reqNS = reqWrapper.targetNamespace().length() > 0 ?
reqWrapper.targetNamespace() : reqNS;
} else {
reqClassName = model.getPackageName() + ".jaxws." +
AnnotationUtil.capitalize(method.getName());
}
@@ -109,8 +107,6 @@
String resNS = model.getTargetNameSpace();
if (resWrapper != null &&
!StringUtils.isEmpty(resWrapper.className())) {
resClassName = resWrapper.className();
- resName = resWrapper.localName().length() > 0 ?
resWrapper.localName() : resName;
- resNS = resWrapper.targetNamespace().length() > 0 ?
resWrapper.targetNamespace() : resNS;
} else {
resClassName = model.getPackageName() + ".jaxws."
+ AnnotationUtil.capitalize(method.getName())
Added:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
(added)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
[EMAIL PROTECTED]
+
+public interface Stock {
+ @WebMethod
+ @RequestWrapper(localName = "xXx" ,
+ className =
"org.apache.cxf.tools.fortest.withannotation.doc.jaxws.GetPrice")
+ @ResponseWrapper(localName = "zZz" ,
+ className =
"org.apache.cxf.tools.fortest.withannotation.doc.jaxws.GetPriceResponse")
+ float getPrice(String tickerSymbol);
+}
Added:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
(added)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,82 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for getPrice element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="getPrice">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="responseType"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {"responseType" })
[EMAIL PROTECTED](name = "getPrice")
+public class GetPrice {
+
+ @XmlElement(required = true)
+ protected String responseType;
+
+ /**
+ * Gets the value of the responseType property.
+ *
+ * @return
+ * possible object is
+ * [EMAIL PROTECTED] String }
+ *
+ */
+ public String getResponseType() {
+ return responseType;
+ }
+
+ /**
+ * Sets the value of the responseType property.
+ *
+ * @param value
+ * allowed object is
+ * [EMAIL PROTECTED] String }
+ *
+ */
+ public void setResponseType(String value) {
+ this.responseType = value;
+ }
+
+}
Added:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
(added)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,72 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for getPriceResponse element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="getPriceResponse">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="responseType"
type="{http://www.w3.org/2001/XMLSchema}float"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {"responseType" })
[EMAIL PROTECTED](name = "getPriceResponse")
+public class GetPriceResponse {
+
+ protected float responseType;
+
+ /**
+ * Gets the value of the responseType property.
+ *
+ */
+ public float getResponseType() {
+ return responseType;
+ }
+
+ /**
+ * Sets the value of the responseType property.
+ *
+ */
+ public void setResponseType(float value) {
+ this.responseType = value;
+ }
+
+}
Added:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
(added)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,68 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.cxf.tools.fortest.classnoanno.docwrapped.jaxws
package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
[EMAIL PROTECTED]
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to
+ * create new instances of schema derived classes
+ * for package: org.apache.cxf.tools.fortest.classnoanno.docwrapped.jaxws
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] GetPrice }
+ *
+ */
+ public GetPrice createGetPrice() {
+ return new GetPrice();
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] GetPriceResponse }
+ *
+ */
+ public GetPriceResponse createGetPriceResponse() {
+ return new GetPriceResponse();
+ }
+
+}
Modified:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
(original)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLNoAnnoTest.java
Tue Mar 6 03:21:21 2007
@@ -19,8 +19,6 @@
package org.apache.cxf.tools.java2wsdl.processor;
-//import java.io.File;
-
import org.apache.cxf.tools.common.ToolConstants;
public class JavaToWSDLNoAnnoTest extends ProcessorTestBase {
Modified:
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
(original)
+++
incubator/cxf/trunk/tools/java2wsdl/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
Tue Mar 6 03:21:21 2007
@@ -19,9 +19,12 @@
package org.apache.cxf.tools.java2wsdl.processor;
+import java.io.BufferedInputStream;
import java.io.File;
+import java.io.FileInputStream;
+import java.util.HashMap;
import java.util.Iterator;
-
+import java.util.Map;
import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Port;
@@ -31,8 +34,13 @@
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.wsdl.extensions.soap12.SOAP12Binding;
import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
import org.apache.cxf.helpers.WSDLHelper;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.tools.common.WSDLConstants;
@@ -310,6 +318,31 @@
String expected = "Method [sayHi] processing error : SOAPBinding
annotation "
+ "can not be placed on method with RPC style";
assertTrue(e.getMessage().contains(expected));
+ } catch (Exception e) {
+ fail("Should not happen other exception " + e.getMessage());
+ }
+ }
+
+ public void testDocWrappedWithLocalName() {
+ Map<String, String> ns = new HashMap<String, String>();
+ ns.put("xsd", "http://www.w3.org/2001/XMLSchema");
+
+ env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() +
"/doc_lit_wrapped_localName.wsdl");
+ env.put(ToolConstants.CFG_CLASSNAME,
"org.apache.cxf.tools.fortest.withannotation.doc.Stock");
+ env.put(ToolConstants.CFG_SERVICENAME, serviceName);
+ j2wProcessor.setEnvironment(env);
+ try {
+ j2wProcessor.process();
+ File file = new File(output, "schema1.xsd");
+ assertTrue(file.exists());
+ Document root = XMLUtils.parse(new BufferedInputStream(new
FileInputStream(file)));
+ XPathUtils xpather = new XPathUtils(ns);
+ assertNull(xpather.getValue("/xsd:schema/xsd:[EMAIL
PROTECTED]'xXx']",
+ root,
+ XPathConstants.NODE));
+ assertNotNull(xpather.getValue("/xsd:schema/xsd:[EMAIL
PROTECTED]'getPrice']",
+ root,
+ XPathConstants.NODE));
} catch (Exception e) {
fail("Should not happen other exception " + e.getMessage());
}
Modified:
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
(original)
+++
incubator/cxf/trunk/tools/wsdl2java/src/main/java/org/apache/cxf/tools/wsdl2java/processor/WSDLToJavaProcessor.java
Tue Mar 6 03:21:21 2007
@@ -56,7 +56,6 @@
if (env.get(ToolConstants.CFG_COMPILE) != null) {
new ClassUtils().compile(env);
- //compile();
}
try {
if (env.isExcludeNamespaceEnabled()) {
@@ -205,123 +204,4 @@
}
return binding;
}
-
-// private void compile() throws ToolException {
-// ClassCollector classCollector =
(ClassCollector)env.get(ToolConstants.GENERATED_CLASS_COLLECTOR);
-// List<String> argList = new ArrayList<String>();
-// List<String> fileList = new ArrayList<String>();
-//
-// String javaClasspath = System.getProperty("java.class.path");
-// // hard code cxf.jar
-// boolean classpathSetted = javaClasspath != null ? true : false;
-// // && (javaClasspath.indexOf("cxf.jar") >= 0);
-// if (env.isVerbose()) {
-// argList.add("-verbose");
-// }
-//
-// if (env.get(ToolConstants.CFG_CLASSDIR) != null) {
-// argList.add("-d");
-//
argList.add(((String)env.get(ToolConstants.CFG_CLASSDIR)).replace(File.pathSeparatorChar,
'/'));
-// }
-//
-// if (!classpathSetted) {
-// argList.add("-extdirs");
-//
argList.add(getClass().getClassLoader().getResource(".").getFile() + "../lib/");
-// } else {
-// argList.add("-classpath");
-// argList.add(javaClasspath);
-// }
-//
-// String outPutDir = (String)env.get(ToolConstants.CFG_OUTPUTDIR);
-//
-// Set<String> dirSet = new HashSet<String>();
-// Iterator ite = classCollector.getGeneratedFileInfo().iterator();
-// while (ite.hasNext()) {
-// String fileName = (String)ite.next();
-// fileName = fileName.replace('.', File.separatorChar);
-// String dirName = fileName.substring(0,
fileName.lastIndexOf(File.separator) + 1);
-//
-// String path = outPutDir + File.separator + dirName;
-// if (!dirSet.contains(path)) {
-//
-// dirSet.add(path);
-// File file = new File(path);
-// if (file.isDirectory()) {
-// for (String str : file.list()) {
-// if (str.endsWith("java")) {
-// fileList.add(path + str);
-// } else {
-// // copy generated xml file or others to class
-// // directory
-// File otherFile = new File(path + File.separator
+ str);
-// if (otherFile.isFile() &&
str.toLowerCase().endsWith("xml")
-// && env.get(ToolConstants.CFG_CLASSDIR) !=
null) {
-// String targetDir =
(String)env.get(ToolConstants.CFG_CLASSDIR);
-//
-// File targetFile = new File(targetDir +
File.separator + dirName
-// + File.separator
+ str);
-// copyXmlFile(otherFile, targetFile);
-// }
-// }
-// }
-// }
-// }
-//
-// }
-// //Jaxb's bug . Jaxb ClassNameCollecotr may not be invoked when
generated class is an enum.
-// //So we need recheck whether we add all generated source files to
fileList
-//
-// String[] arguments = new String[argList.size() + fileList.size() +
1];
-// arguments[0] = "javac";
-//
-// int i = 1;
-//
-// for (Object obj : argList.toArray()) {
-// String arg = (String)obj;
-// arguments[i] = arg;
-// i++;
-// }
-//
-// int srcFileIndex = i;
-//
-// for (Object o : fileList.toArray()) {
-// String file = (String)o;
-// arguments[i] = file;
-// i++;
-// }
-//
-// Compiler compiler = new Compiler();
-//
-// if (!compiler.internalCompile(arguments, srcFileIndex)) {
-// Message msg = new Message("FAIL_TO_COMPILE_GENERATE_CODES", LOG);
-// throw new ToolException(msg);
-// }
-//
-// }
-//
-// private void copyXmlFile(File from, File to) throws ToolException {
-//
-// try {
-// String dir = to.getCanonicalPath()
-// .substring(0,
to.getCanonicalPath().lastIndexOf(File.separator));
-// File dirFile = new File(dir);
-// dirFile.mkdirs();
-// FileInputStream input = new FileInputStream(from);
-// FileOutputStream output = new FileOutputStream(to);
-// byte[] b = new byte[1024 * 3];
-// int len = 0;
-// while (len != -1) {
-// len = input.read(b);
-// if (len != -1) {
-// output.write(b, 0, len);
-// }
-// }
-// output.flush();
-// output.close();
-// input.close();
-// } catch (Exception e) {
-// Message msg = new
Message("FAIL_TO_COPY_GENERATED_RESOURCE_FILE", LOG);
-// throw new ToolException(msg, e);
-// }
-// }
}
Modified:
incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
(original)
+++
incubator/cxf/trunk/tools2/common/src/main/java/org/apache/cxf/tools/common/model/WSDLModel.java
Tue Mar 6 03:21:21 2007
@@ -142,6 +142,7 @@
return this.methods;
}
+ @SuppressWarnings(value = "deprecation")
public void createJAXBContext() throws ToolException {
List<TypeReference> types = this.getAllTypeReference();
Class[] clzzs = new Class[types.size()];
Modified:
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/jaxws/WSDLGenerator.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/jaxws/WSDLGenerator.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/jaxws/WSDLGenerator.java
(original)
+++
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/generator/jaxws/WSDLGenerator.java
Tue Mar 6 03:21:21 2007
@@ -104,8 +104,4 @@
}
return true;
}
-
-
-
-
}
Modified:
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/WrapperUtil.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/WrapperUtil.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/WrapperUtil.java
(original)
+++
incubator/cxf/trunk/tools2/javato/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/WrapperUtil.java
Tue Mar 6 03:21:21 2007
@@ -40,8 +40,6 @@
String reqNS = null;
if (reqWrapper != null &&
!StringUtils.isEmpty(reqWrapper.className())) {
reqClassName = reqWrapper.className().length() > 0 ?
reqWrapper.className() : reqClassName;
- reqName = reqWrapper.localName().length() > 0 ?
reqWrapper.localName() : reqName;
- reqNS = reqWrapper.targetNamespace();
} else {
reqClassName = getPackageName(method) + ".jaxws." +
AnnotationUtil.capitalize(method.getName());
}
@@ -57,8 +55,6 @@
String resNS = null;
if (resWrapper != null &&
!StringUtils.isEmpty(resWrapper.className())) {
resClassName = resWrapper.className();
- resName = resWrapper.localName().length() > 0 ?
resWrapper.localName() : resName;
- resNS = resWrapper.targetNamespace();
} else {
resClassName = getPackageName(method) + ".jaxws."
+ AnnotationUtil.capitalize(method.getName())
Added:
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
(added)
+++
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/Stock.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,36 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
[EMAIL PROTECTED]
+
+public interface Stock {
+ @WebMethod
+ @RequestWrapper(localName = "xXx" ,
+ className =
"org.apache.cxf.tools.fortest.withannotation.doc.jaxws.GetPrice")
+ @ResponseWrapper(localName = "zZz" ,
+ className =
"org.apache.cxf.tools.fortest.withannotation.doc.jaxws.GetPriceResponse")
+ float getPrice(String tickerSymbol);
+}
Added:
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
(added)
+++
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,82 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for getPrice element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="getPrice">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="responseType"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {"responseType" })
[EMAIL PROTECTED](name = "getPrice")
+public class GetPrice {
+
+ @XmlElement(required = true)
+ protected String responseType;
+
+ /**
+ * Gets the value of the responseType property.
+ *
+ * @return
+ * possible object is
+ * [EMAIL PROTECTED] String }
+ *
+ */
+ public String getResponseType() {
+ return responseType;
+ }
+
+ /**
+ * Sets the value of the responseType property.
+ *
+ * @param value
+ * allowed object is
+ * [EMAIL PROTECTED] String }
+ *
+ */
+ public void setResponseType(String value) {
+ this.responseType = value;
+ }
+
+}
Added:
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
(added)
+++
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,72 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for getPriceResponse element declaration.
+ *
+ * <p>The following schema fragment specifies the expected content contained
within this class.
+ *
+ * <pre>
+ * <element name="getPriceResponse">
+ * <complexType>
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="responseType"
type="{http://www.w3.org/2001/XMLSchema}float"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </element>
+ * </pre>
+ *
+ *
+ */
[EMAIL PROTECTED](XmlAccessType.FIELD)
[EMAIL PROTECTED](name = "", propOrder = {"responseType" })
[EMAIL PROTECTED](name = "getPriceResponse")
+public class GetPriceResponse {
+
+ protected float responseType;
+
+ /**
+ * Gets the value of the responseType property.
+ *
+ */
+ public float getResponseType() {
+ return responseType;
+ }
+
+ /**
+ * Sets the value of the responseType property.
+ *
+ */
+ public void setResponseType(float value) {
+ this.responseType = value;
+ }
+
+}
Added:
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java?view=auto&rev=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
(added)
+++
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/ObjectFactory.java
Tue Mar 6 03:21:21 2007
@@ -0,0 +1,68 @@
+/**
+ * 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.cxf.tools.fortest.withannotation.doc.jaxws;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.apache.cxf.tools.fortest.classnoanno.docwrapped.jaxws
package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
[EMAIL PROTECTED]
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to
+ * create new instances of schema derived classes
+ * for package: org.apache.cxf.tools.fortest.classnoanno.docwrapped.jaxws
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] GetPrice }
+ *
+ */
+ public GetPrice createGetPrice() {
+ return new GetPrice();
+ }
+
+ /**
+ * Create an instance of [EMAIL PROTECTED] GetPriceResponse }
+ *
+ */
+ public GetPriceResponse createGetPriceResponse() {
+ return new GetPriceResponse();
+ }
+
+}
Modified:
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
(original)
+++
incubator/cxf/trunk/tools2/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
Tue Mar 6 03:21:21 2007
@@ -19,9 +19,12 @@
package org.apache.cxf.tools.java2wsdl.processor;
-import java.io.*;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.HashMap;
import java.util.Iterator;
-
+import java.util.Map;
import javax.wsdl.Binding;
import javax.wsdl.Definition;
import javax.wsdl.Port;
@@ -31,8 +34,13 @@
import javax.wsdl.extensions.soap12.SOAP12Address;
import javax.wsdl.extensions.soap12.SOAP12Binding;
import javax.xml.namespace.QName;
+import javax.xml.xpath.XPathConstants;
+
+import org.w3c.dom.Document;
import org.apache.cxf.helpers.WSDLHelper;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.helpers.XPathUtils;
import org.apache.cxf.tools.common.ToolConstants;
import org.apache.cxf.tools.common.ToolException;
import org.apache.cxf.tools.common.WSDLConstants;
@@ -40,6 +48,7 @@
import org.apache.cxf.tools.util.SOAPBindingUtil;
import org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer;
+
public class JavaToWSDLProcessorTest extends ProcessorTestBase {
private JavaToWSDLProcessor j2wProcessor;
@@ -309,6 +318,31 @@
String expected = "Method [sayHi] processing error : SOAPBinding
annotation "
+ "can not be placed on method with RPC style";
assertTrue(e.getMessage().contains(expected));
+ } catch (Exception e) {
+ fail("Should not happen other exception " + e.getMessage());
+ }
+ }
+
+ public void testDocWrappedWithLocalName() {
+ Map<String, String> ns = new HashMap<String, String>();
+ ns.put("xsd", "http://www.w3.org/2001/XMLSchema");
+
+ env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() +
"/doc_lit_wrapped_localName.wsdl");
+ env.put(ToolConstants.CFG_CLASSNAME,
"org.apache.cxf.tools.fortest.withannotation.doc.Stock");
+ env.put(ToolConstants.CFG_SERVICENAME, serviceName);
+ j2wProcessor.setEnvironment(env);
+ try {
+ j2wProcessor.process();
+ File file = new File(output, "schema1.xsd");
+ assertTrue(file.exists());
+ Document root = XMLUtils.parse(new BufferedInputStream(new
FileInputStream(file)));
+ XPathUtils xpather = new XPathUtils(ns);
+ assertNull(xpather.getValue("/xsd:schema/xsd:[EMAIL
PROTECTED]'xXx']",
+ root,
+ XPathConstants.NODE));
+ assertNotNull(xpather.getValue("/xsd:schema/xsd:[EMAIL
PROTECTED]'getPrice']",
+ root,
+ XPathConstants.NODE));
} catch (Exception e) {
fail("Should not happen other exception " + e.getMessage());
}
Modified:
incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java?view=diff&rev=515077&r1=515076&r2=515077
==============================================================================
---
incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
(original)
+++
incubator/cxf/trunk/tools2/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/processor/WSDLToJavaProcessor.java
Tue Mar 6 03:21:21 2007
@@ -49,8 +49,6 @@
JavaModel javaModel = new JavaModel();
context.put(JavaModel.class, javaModel);
- //TODO : refactroing the internal processors to use the service model
-
PortTypeProcessor portTypeProcessor = new PortTypeProcessor(context);
portTypeProcessor.process(serviceInfo);