You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by jl...@apache.org on 2007/04/19 13:30:08 UTC
svn commit: r530382 - in /incubator/cxf/trunk:
rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/
tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/
tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotat...
Author: jliu
Date: Thu Apr 19 04:30:01 2007
New Revision: 530382
URL: http://svn.apache.org/viewvc?view=rev&rev=530382
Log:
CXF-547: fixed a problem in javatowsdl that did not look up wrapper bean class (which is located under [packagename].jaxws directory by default) if there is no @RequestWrapper/@ResponseWrapper presented.
Added:
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java (with props)
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl (with props)
Modified:
incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceConfiguration.java Thu Apr 19 04:30:01 2007
@@ -47,6 +47,7 @@
import org.apache.cxf.service.model.InterfaceInfo;
import org.apache.cxf.service.model.MessageInfo;
import org.apache.cxf.service.model.OperationInfo;
+import org.apache.cxf.tools.util.AnnotationUtil;
public class JaxWsServiceConfiguration extends AbstractServiceConfiguration {
@@ -381,16 +382,25 @@
Method m = getDeclaredMethod(selected);
ResponseWrapper rw = m.getAnnotation(ResponseWrapper.class);
+ String clsName = "";
+ boolean isWrapperSpecifiedByAnno = true;
if (rw == null) {
- return null;
+ clsName = getPackageName(selected) + ".jaxws." + AnnotationUtil.capitalize(selected.getName())
+ + "Response";
+ isWrapperSpecifiedByAnno = false;
+ } else {
+ clsName = rw.className();
}
-
- String clsName = rw.className();
+
if (clsName.length() > 0) {
try {
return ClassLoaderUtils.loadClass(clsName, getClass());
} catch (ClassNotFoundException e) {
- throw new ServiceConstructionException(e);
+ if (isWrapperSpecifiedByAnno) {
+ throw new ServiceConstructionException(e);
+ } else {
+ //do nothing, we will mock a schema for wrapper bean later on
+ }
}
}
@@ -402,23 +412,34 @@
Method m = getDeclaredMethod(selected);
RequestWrapper rw = m.getAnnotation(RequestWrapper.class);
+ String clsName = "";
+ boolean isWrapperSpecifiedByAnno = true;
if (rw == null) {
- return null;
+ clsName = getPackageName(selected) + ".jaxws." + AnnotationUtil.capitalize(selected.getName());
+ isWrapperSpecifiedByAnno = false;
+ } else {
+ clsName = rw.className();
}
- String clsName = rw.className();
-
if (clsName.length() > 0) {
try {
return ClassLoaderUtils.loadClass(clsName, getClass());
} catch (ClassNotFoundException e) {
- throw new ServiceConstructionException(e);
+ if (isWrapperSpecifiedByAnno) {
+ throw new ServiceConstructionException(e);
+ } else {
+ //do nothing, we will mock a schema for wrapper bean later on
+ }
}
}
return null;
}
-
+
+ private static String getPackageName(Method method) {
+ return method.getDeclaringClass().getPackage().getName();
+ }
+
@Override
public QName getFaultName(InterfaceInfo service, OperationInfo o, Class<?> exClass, Class<?> beanClass) {
WebFault fault = exClass.getAnnotation(WebFault.class);
Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java?view=auto&rev=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java Thu Apr 19 04:30:01 2007
@@ -0,0 +1,31 @@
+/**
+ * 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.jws.soap.SOAPBinding;
+
+@SOAPBinding(style = SOAPBinding.Style.DOCUMENT, use = SOAPBinding.Use.LITERAL)
+@WebService(name = "StockWrapped", targetNamespace = "http://cxf.com/")
+public interface StockWrapped {
+ @WebMethod(operationName = "getPrice", exclude = false)
+ float getPrice(String tickerSymbol);
+}
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/StockWrapped.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPrice.java Thu Apr 19 04:30:01 2007
@@ -48,8 +48,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"responseType" })
-@XmlRootElement(name = "getPrice")
+@XmlType(name = "", propOrder = {"responseType" }, namespace = "http://cxf.com/")
+@XmlRootElement(name = "getPrice", namespace = "http://cxf.com/")
public class GetPrice {
@XmlElement(required = true)
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/fortest/withannotation/doc/jaxws/GetPriceResponse.java Thu Apr 19 04:30:01 2007
@@ -47,8 +47,8 @@
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {"responseType" })
-@XmlRootElement(name = "getPriceResponse")
+@XmlType(name = "", propOrder = {"responseType" }, namespace = "http://cxf.com/")
+@XmlRootElement(name = "getPriceResponse", namespace = "http://cxf.com/")
public class GetPriceResponse {
protected float responseType;
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToProcessorTest.java Thu Apr 19 04:30:01 2007
@@ -129,4 +129,5 @@
String expectedFile = getClass().getResource("expected/hello_soap12.wsdl").getFile();
assertFileEquals(new File(expectedFile), new File(output, "hello_soap12.wsdl"));
}
+
}
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/JavaToWSDLProcessorTest.java Thu Apr 19 04:30:01 2007
@@ -320,6 +320,25 @@
} catch (Exception e) {
fail("Should not happen other exception " + e.getMessage());
}
+ }
+
+ @Test
+ public void testDocWrappedWithWrapperClass() {
+ env.put(ToolConstants.CFG_OUTPUTFILE, output.getPath() + "/doc_lit_wrapped_no_anno_nowrapper11.wsdl");
+ env.put(ToolConstants.CFG_CLASSNAME, "org.apache.cxf.tools.fortest.withannotation.doc.Hello");
+ env.put(ToolConstants.CFG_SERVICENAME, serviceName);
+ j2wProcessor.setEnvironment(env);
+ try {
+ j2wProcessor.process();
+ File wsdlFile = new File(output, "doc_lit_wrapped_no_anno_nowrapper11.wsdl");
+ assertTrue(wsdlFile.exists());
+ assertTrue("WSDL file: " + wsdlFile.toString() + " is empty", wsdlFile.length() > 0);
+ } catch (ToolException e) {
+ String expected = "org.apache.cxf.tools.fortest.withannotation.doc.jaxws.SayHi";
+ assertTrue(e.getMessage().contains(expected));
+ } catch (Exception e) {
+ fail("Should not happen other exception " + e.getMessage());
+ }
}
@Test
Modified: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java?view=diff&rev=530382&r1=530381&r2=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java (original)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/JaxwsServiceBuilderTest.java Thu Apr 19 04:30:01 2007
@@ -60,9 +60,8 @@
}
@Test
- @Ignore
public void testDocLitWrappedWithWrapperClass() {
- builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.doc.Hello.class);
+ builder.setServiceClass(org.apache.cxf.tools.fortest.withannotation.doc.StockWrapped.class);
ServiceInfo service = builder.build();
generator.setServiceModel(service);
File output = getOutputFile("doc_lit_wrapped_with_wrapperclass.wsdl");
@@ -71,7 +70,7 @@
assertTrue(output.exists());
String expectedFile = this.getClass()
- .getResource("expected/expected_doc_lit_wrapped_no_wrapperclass.wsdl").getFile();
+ .getResource("expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl").getFile();
assertFileEquals(expectedFile, output.getAbsolutePath());
}
Added: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl?view=auto&rev=530382
==============================================================================
--- incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl (added)
+++ incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl Thu Apr 19 04:30:01 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.
+-->
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions name="StockWrappedService" targetNamespace="http://cxf.com/" xmlns:ns1="http://cxf.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
+ <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://cxf.com/" version="1.0">
+<xs:element name="getPrice">
+<xs:complexType>
+<xs:sequence>
+<xs:element name="responseType" type="xs:string"/>
+</xs:sequence>
+</xs:complexType>
+</xs:element>
+<xs:element name="getPriceResponse">
+<xs:complexType>
+<xs:sequence>
+<xs:element name="responseType" type="xs:float"/>
+</xs:sequence>
+</xs:complexType>
+</xs:element>
+</xs:schema>
+ </wsdl:types>
+ <wsdl:message name="getPrice">
+ <wsdl:part name="getPrice" element="ns1:getPrice">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getPriceResponse">
+ <wsdl:part name="getPriceResponse" element="ns1:getPriceResponse">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="StockWrapped">
+ <wsdl:operation name="getPrice">
+ <wsdl:input name="getPrice" message="ns1:getPrice">
+ </wsdl:input>
+ <wsdl:output name="getPriceResponse" message="ns1:getPriceResponse">
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="StockWrappedServiceSoapBinding" type="ns1:StockWrapped">
+ <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="getPrice">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="getPrice">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="getPriceResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="StockWrappedService">
+ <wsdl:port name="StockWrappedPort" binding="ns1:StockWrappedServiceSoapBinding">
+ <soap:address location="http://localhost:9090"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: incubator/cxf/trunk/tools/javato/src/test/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/expected/expected_doc_lit_wrapped_with_wrapperclass.wsdl
------------------------------------------------------------------------------
svn:mime-type = text/xml