Author: ulhasbhole
Date: Wed Mar  2 17:06:30 2011
New Revision: 1076295

URL: http://svn.apache.org/viewvc?rev=1076295&view=rev
Log:
[CXF-3374] CXF Service Builder fails if the binding is imported from different 
file and has different target namespace than one imported into.


Added:
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
   (with props)
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
   (with props)
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
   (with props)
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/
    
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
   (with props)
Modified:
    
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
    
cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java

Modified: 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=1076295&r1=1076294&r2=1076295&view=diff
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
 (original)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
 Wed Mar  2 17:06:30 2011
@@ -394,6 +394,9 @@ public class ServiceWSDLBuilder {
                 }
             }
             binding.setQName(bindingInfo.getName());
+            if 
(!bindingInfo.getName().getNamespaceURI().equals(definition.getTargetNamespace()))
 {
+                addNamespace(bindingInfo.getName().getNamespaceURI());
+            }
             buildBindingOperation(definition, binding, 
bindingInfo.getOperations());
             addExtensibilityElements(binding, getWSDL11Extensors(bindingInfo));
             definition.addBinding(binding);

Modified: 
cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java?rev=1076295&r1=1076294&r2=1076295&view=diff
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
 (original)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/test/java/org/apache/cxf/wsdl11/ServiceWSDLBuilderTest.java
 Wed Mar  2 17:06:30 2011
@@ -283,6 +283,13 @@ public class ServiceWSDLBuilderTest exte
         assertNotNull(binding);
         assertEquals(4, binding.getBindingOperations().size());
     }
+
+    @Test
+    public void testBindingWithDifferentNamespaceImport() throws Exception {
+        setupWSDL("wsdl2/person.wsdl");
+        assertEquals(newDef.getBindings().size(), 1);
+        
assertTrue(newDef.getNamespace("ns3").equals("http://cxf.apache.org/samples/wsdl-first";));
+    }
     
     @Test
     public void testSchemas() throws Exception {

Added: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl?rev=1076295&view=auto
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
 (added)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
 Wed Mar  2 17:06:30 2011
@@ -0,0 +1,46 @@
+<?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 name="wsdl-first"
+       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:tns="http://cxf.apache.org/samples/wsdl-first/interfaces";
+       xmlns:unused="http://cxf.apache.org/samples/wsdl-first";
+       targetNamespace="http://cxf.apache.org/samples/wsdl-first";>
+
+    <wsdl:import 
namespace="http://cxf.apache.org/samples/wsdl-first/interfaces"; 
location="./person-soap-interfaces.wsdl"/>
+
+    <wsdl:binding name="PersonSOAPBinding" type="tns:Person">
+       <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"; />
+               <wsdl:operation name="GetPerson">
+                       <wsdl:input>
+                               <soap:body use="literal" />
+                       </wsdl:input>
+                       <wsdl:output>
+                               <soap:body use="literal" />
+                       </wsdl:output>
+                       <wsdl:fault name="UnknownPerson">
+                               <soap:fault use="literal" name="UnknownPerson" 
/>
+                       </wsdl:fault>
+       </wsdl:operation>
+   </wsdl:binding>
+
+</wsdl:definitions>

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-binding.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl?rev=1076295&view=auto
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
 (added)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
 Wed Mar  2 17:06:30 2011
@@ -0,0 +1,52 @@
+<?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 name="wsdl-first"
+       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:tns="http://cxf.apache.org/samples/wsdl-first/interfaces";
+       xmlns:typens="http://cxf.apache.org/samples/wsdl-first/types";
+       targetNamespace="http://cxf.apache.org/samples/wsdl-first/interfaces";>
+
+    <wsdl:types>
+      <xsd:schema 
targetNamespace="http://cxf.apache.org/samples/wsdl-first/types"; 
elementFormDefault="qualified">
+         <xsd:include schemaLocation="./person-types.xsd"/>
+      </xsd:schema>
+    </wsdl:types>
+
+       <wsdl:message name="GetPersonRequest">
+               <wsdl:part name="payload" element="typens:GetPerson"/>
+       </wsdl:message>
+       <wsdl:message name="GetPersonResponse">
+               <wsdl:part name="payload" element="typens:GetPersonResponse"/>
+       </wsdl:message>
+       <wsdl:message name="UnknownPersonFault">
+               <wsdl:part name="payload" element="typens:UnknownPersonFault"/>
+       </wsdl:message>
+
+    <wsdl:portType name="Person">
+               <wsdl:operation name="GetPerson">
+                       <wsdl:input message="tns:GetPersonRequest"/>
+                       <wsdl:output message="tns:GetPersonResponse"/>
+                       <wsdl:fault name="UnknownPerson" 
message="tns:UnknownPersonFault"/>
+               </wsdl:operation>
+       </wsdl:portType>
+</wsdl:definitions>

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-soap-interfaces.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd?rev=1076295&view=auto
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
 (added)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
 Wed Mar  2 17:06:30 2011
@@ -0,0 +1,46 @@
+<?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.
+
+-->
+               <xsd:schema 
targetNamespace="http://cxf.apache.org/samples/wsdl-first/types";
+                    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                           elementFormDefault="qualified">
+                       <xsd:element name="GetPerson">
+                         <xsd:complexType>
+                                       <xsd:sequence>
+                                               <xsd:element name="personId" 
type="xsd:string"/>
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+                       <xsd:element name="GetPersonResponse">
+                         <xsd:complexType>
+                                       <xsd:sequence>
+                                           <xsd:element name="personId" 
type="xsd:string"/>
+                                               <xsd:element name="ssn" 
type="xsd:string"/>
+                                               <xsd:element name="name" 
type="xsd:string"/>
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+                       <xsd:element name="UnknownPersonFault">
+                         <xsd:complexType>
+                                       <xsd:sequence>
+                                           <xsd:element name="personId" 
type="xsd:string"/>
+                                       </xsd:sequence>
+                               </xsd:complexType>
+                       </xsd:element>
+               </xsd:schema>

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl1/person-types.xsd
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
URL: 
http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl?rev=1076295&view=auto
==============================================================================
--- 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
 (added)
+++ 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
 Wed Mar  2 17:06:30 2011
@@ -0,0 +1,37 @@
+<?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 name="wsdl-first"
+       xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
+       xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
+       xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:tns="http://cxf.apache.org/samples/wsdl-first";
+       targetNamespace="urn:cxf:apache:org:samples:wsdl-first">
+
+    <wsdl:import namespace="http://cxf.apache.org/samples/wsdl-first";
+                 location="../wsdl1/person-soap-binding.wsdl"/>
+
+       <wsdl:service name="PersonService">
+       <wsdl:port binding="tns:PersonSOAPBinding" name="soap">
+           <soap:address location="http://localhost:8092/PersonService/"; />
+       </wsdl:port>
+   </wsdl:service>
+
+</wsdl:definitions>

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
cxf/branches/2.3.x-fixes/rt/core/src/test/resources/org/apache/cxf/wsdl11/wsdl2/person.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml


Reply via email to