Author: ffang
Date: Mon Dec 20 13:27:03 2010
New Revision: 1051094

URL: http://svn.apache.org/viewvc?rev=1051094&view=rev
Log:
[CXF-2810]wrong namespace in generated wsdl which conflict with aegis type 
annation namespace in SEI

Added:
    
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNs.java
    
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNsImpl.java
    
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisWSDLNSTest.java
    cxf/trunk/systests/databinding/src/test/resources/aegisWSDLNSBeans.xml
Modified:
    
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java

Modified: 
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java?rev=1051094&r1=1051093&r2=1051094&view=diff
==============================================================================
--- 
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
 (original)
+++ 
cxf/trunk/rt/databinding/aegis/src/main/java/org/apache/cxf/aegis/type/java5/Java5TypeCreator.java
 Mon Dec 20 13:27:03 2010
@@ -250,7 +250,11 @@ public class Java5TypeCreator extends Ab
         if (name == null || name.length() == 0) {
             name = ServiceUtils.makeServiceNameFromClassName(typeClass);
         }
-
+        
+        //check from aegis type annotation
+        if (ns == null || ns.length() == 0) {
+            ns = annotationReader.getNamespace(typeClass);
+        }
         // check jaxb package annotation
         if (ns == null || ns.length() == 0) {
             ns = annotationReader.getNamespace(typeClass.getPackage());

Added: 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNs.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNs.java?rev=1051094&view=auto
==============================================================================
--- 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNs.java
 (added)
+++ 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNs.java
 Mon Dec 20 13:27:03 2010
@@ -0,0 +1,49 @@
+/**
+ * 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.systest.aegis;
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import org.apache.cxf.aegis.type.java5.XmlType;
+
+
+/**
+ * 
+ */
+...@webservice(name = "AegisJaxWsWsdlNs", targetNamespace = 
"http://v1_1_2.rtf2pdf.doc.ws.daisy.marbes.cz";)
+public interface AegisJaxWsWsdlNs {
+
+    void updateVO(@WebParam(name = "VO")VO vo);
+
+    @XmlType(name = "VOX", namespace = 
"http://wo.rtf2pdf.doc.ws.daisy.marbes.cz";)
+    public class VO {
+
+        private String str;
+
+        public String getStr() {
+            return str;
+        }
+
+        public void setStr(String str) {
+            this.str = str;
+        }
+    }
+
+}

Added: 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNsImpl.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNsImpl.java?rev=1051094&view=auto
==============================================================================
--- 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNsImpl.java
 (added)
+++ 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisJaxWsWsdlNsImpl.java
 Mon Dec 20 13:27:03 2010
@@ -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.systest.aegis;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.annotations.Logging;
+
+...@logging
+...@webservice(endpointInterface = 
"org.apache.cxf.systest.aegis.AegisJaxWsWsdlNs",
+        targetNamespace = "http://v1_1_2.rtf2pdf.doc.ws.daisy.marbes.cz";)
+public class AegisJaxWsWsdlNsImpl implements AegisJaxWsWsdlNs {
+    
+
+    public void updateVO(VO vo) {
+
+        System.out.println(vo.getStr());
+    }
+
+}

Added: 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisWSDLNSTest.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisWSDLNSTest.java?rev=1051094&view=auto
==============================================================================
--- 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisWSDLNSTest.java
 (added)
+++ 
cxf/trunk/systests/databinding/src/test/java/org/apache/cxf/systest/aegis/AegisWSDLNSTest.java
 Mon Dec 20 13:27:03 2010
@@ -0,0 +1,98 @@
+/**
+ * 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.systest.aegis;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.aegis.databinding.AegisDatabinding;
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.test.TestUtilities;
+import org.apache.cxf.testutil.common.TestUtil;
+
+import org.junit.Test;
+
+import org.springframework.test.context.ContextConfiguration;
+import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
+
+/**
+ * 
+ */
+...@contextconfiguration(locations = { "classpath:aegisWSDLNSBeans.xml" })
+public class AegisWSDLNSTest extends AbstractJUnit4SpringContextTests {
+    static final String PORT = TestUtil.getPortNumber(AegisWSDLNSTest.class);
+
+    private AegisJaxWsWsdlNs client;
+    
+    public AegisWSDLNSTest() {
+    }
+    
+    private void setupForTest(boolean specifyWsdl) throws Exception {
+        
+        JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+        factory.setServiceClass(AegisJaxWsWsdlNs.class);
+        if (specifyWsdl) {
+            factory.setServiceName(new 
QName("http://v1_1_2.rtf2pdf.doc.ws.daisy.marbes.cz";, 
+                                             "AegisJaxWsWsdlNsImplService")); 
+            factory.setWsdlLocation("http://localhost:"; + PORT + 
"/aegisJaxWsWSDLNS?wsdl");
+        }
+        factory.getServiceFactory().setDataBinding(new AegisDatabinding());
+        factory.setAddress("http://localhost:"; + PORT + "/aegisJaxWsWSDLNS"); 
+        client = (AegisJaxWsWsdlNs)factory.create();
+    }
+    
+    @Test
+    public void testWithInterface() throws Exception {
+        setupForTest(false);
+        AegisJaxWsWsdlNs.VO vo = new AegisJaxWsWsdlNs.VO();
+        vo.setStr("ffang");
+        client.updateVO(vo);
+    }
+    
+    @Test
+    public void testWithWsdl() throws Exception {
+        setupForTest(true);
+        AegisJaxWsWsdlNs.VO vo = new AegisJaxWsWsdlNs.VO();
+        vo.setStr("ffang");
+        client.updateVO(vo);        
+    }
+    
+    @Test
+    public void testGeneratedWsdlNs() throws Exception {
+        URL url = new URL("http://localhost:"; + PORT + 
"/aegisJaxWsWSDLNS?wsdl");
+        Document dom = XMLUtils.parse(url.openStream());
+        TestUtilities util = new TestUtilities(this.getClass());
+        util.addDefaultNamespaces();
+        util.assertValid(
+                         "//wsdl:definitio...@targetnamespace" 
+                         + "='http://v1_1_2.rtf2pdf.doc.ws.daisy.marbes.cz']",
+                         dom);
+        //should be a targetNamespace for 
"http://wo.rtf2pdf.doc.ws.daisy.marbes.cz";
+        //as VO type specified in the SEI
+        
util.assertValid("//wsdl:definitions/wsdl:types/xsd:sche...@targetnamespace"
+                         + "='http://wo.rtf2pdf.doc.ws.daisy.marbes.cz']",
+                         dom);
+    }
+   
+}

Added: cxf/trunk/systests/databinding/src/test/resources/aegisWSDLNSBeans.xml
URL: 
http://svn.apache.org/viewvc/cxf/trunk/systests/databinding/src/test/resources/aegisWSDLNSBeans.xml?rev=1051094&view=auto
==============================================================================
--- cxf/trunk/systests/databinding/src/test/resources/aegisWSDLNSBeans.xml 
(added)
+++ cxf/trunk/systests/databinding/src/test/resources/aegisWSDLNSBeans.xml Mon 
Dec 20 13:27:03 2010
@@ -0,0 +1,63 @@
+<?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.
+-->
+
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:simple="http://cxf.apache.org/simple";
+       xmlns:jaxws="http://cxf.apache.org/jaxws";
+       xmlns:cxf="http://cxf.apache.org/core";
+       xsi:schemaLocation="
+http://www.springframework.org/schema/beans 
+http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/simple
+http://cxf.apache.org/schemas/simple.xsd
+http://cxf.apache.org/jaxws
+http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd";>
+
+       <import resource="classpath:META-INF/cxf/cxf.xml" />
+       <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
+       <import resource="classpath:META-INF/cxf/cxf-extension-http.xml" />
+       <import
+               resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml" 
/>
+               
+       <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+       
+       <bean id="aegisBean"
+               class="org.apache.cxf.aegis.databinding.AegisDatabinding"
+               scope="prototype" />
+
+       <bean id="jaxws-and-aegis-service-factory"
+               class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean"
+               scope="prototype">
+               <property name="dataBinding" ref="aegisBean" />
+       </bean>
+
+       <bean id="impl" 
class="org.apache.cxf.systest.aegis.AegisJaxWsWsdlNsImpl" />
+
+       <jaxws:endpoint id="aegisImpl" implementor="#impl"
+               
address="http://localhost:${testutil.ports.AegisWSDLNSTest}/aegisJaxWsWSDLNS";>
+               <jaxws:serviceFactory>
+                       <ref bean='jaxws-and-aegis-service-factory' />
+               </jaxws:serviceFactory>
+       </jaxws:endpoint>
+       
+       
+</beans>


Reply via email to