You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by sl...@apache.org on 2009/10/09 10:49:49 UTC

svn commit: r823459 - in /tuscany/branches/sca-java-1.5.2: itest/wsdlgen/src/main/java/helloworld/ itest/wsdlgen/src/main/resources/ itest/wsdlgen/src/main/resources/wsdl/ itest/wsdlgen/src/test/java/helloworld/ modules/binding-ws-wsdlgen/src/main/java...

Author: slaws
Date: Fri Oct  9 08:49:49 2009
New Revision: 823459

URL: http://svn.apache.org/viewvc?rev=823459&view=rev
Log:
TUSCANY-3283 generate unannotated beans into the namespace of the WSDL rather than an empty namespace

Added:
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java   (with props)
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite   (with props)
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl   (with props)
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java   (with props)
Removed:
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
Modified:
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/ABean.java
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
    tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
    tuscany/branches/sca-java-1.5.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
    tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java

Modified: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/ABean.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/ABean.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/ABean.java (original)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/ABean.java Fri Oct  9 08:49:49 2009
@@ -18,10 +18,15 @@
  */
 package helloworld;
 
+import anotherpackage.BBean;
+
+
+
 public class ABean {
     
     protected String field1;
     protected String field2;
+    protected BBean field3;
 
     public String getField1() {
         return field1;
@@ -38,5 +43,13 @@
     public void setField2(String field2) {
         this.field2 = field2;
     }
+
+    public BBean getField3() {
+        return field3;
+    }
+    
+    public void setField3(BBean field3) {
+        this.field3 = field3;
+    }
 }
 

Added: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java?rev=823459&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java (added)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java Fri Oct  9 08:49:49 2009
@@ -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 helloworld;
+
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Service;
+
+import yetanotherpackage.DBean;
+
+import anotherpackage.BBean;
+import anotherpackage.CBean;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+@Service(HelloWorldService.class)
+public class HelloWorldClientImpl implements HelloWorldService {
+    
+    @Reference
+    protected HelloWorldService hwService;
+
+    public String getGreetings(String name) {
+        return "Hello " + hwService.getGreetings(name);
+    }
+    
+    public String getGreetingsBean(ABean bean){
+        return "Hello " + hwService.getGreetingsBean(bean);
+    }
+
+    public String getGreetingsBeanArray(ABean[] bean){
+        return "Hello " + hwService.getGreetingsBeanArray(bean);
+    }
+   
+    /*
+    public String getGreetingsBeanVector(Vector<ABean> bean){
+        return "Hello " + bean.get(0).getField1() + " " + bean.get(0).getField2();
+    }
+    */
+    
+    public String getGreetingsBBean(BBean bean){
+        return "Hello " + hwService.getGreetingsBBean(bean);
+    }
+    
+    public String getGreetingsCBean(CBean bean){
+        return "Hello " + hwService.getGreetingsCBean(bean);
+    }    
+    
+    public String getGreetingsDBean(DBean bean){
+        return "Hello " + hwService.getGreetingsDBean(bean);
+    }      
+}

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldClientImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java (original)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java Fri Oct  9 08:49:49 2009
@@ -18,31 +18,52 @@
  */
 package helloworld;
 
-import java.util.Vector;
+import javax.jws.WebService;
 
 import org.osoa.sca.annotations.Service;
 
+import yetanotherpackage.DBean;
+
+import anotherpackage.BBean;
+import anotherpackage.CBean;
+
 /**
  * This class implements the HelloWorld service.
  */
+@WebService
 @Service(HelloWorldService.class)
 public class HelloWorldImpl implements HelloWorldService {
 
     public String getGreetings(String name) {
         return "Hello " + name;
     }
-    
-    public String getGreetingsBean(ABean bean){
-        return "Hello " + bean.getField1() + " " + bean.getField2();
+
+    public String getGreetingsBean(ABean bean) {
+        return "Hello " + bean.getField1() + " " + bean.getField2()
+                + bean.getField3().getField1() + " "
+                + bean.getField3().getField2();
     }
 
-    public String getGreetingsBeanArray(ABean[] bean){
+    public String getGreetingsBeanArray(ABean[] bean) {
         return "Hello " + bean[0].getField1() + " " + bean[0].getField2();
     }
-   
+
     /*
-    public String getGreetingsBeanVector(Vector<ABean> bean){
-        return "Hello " + bean.get(0).getField1() + " " + bean.get(0).getField2();
+     * public String getGreetingsBeanVector(Vector<ABean> bean){ return "Hello "
+     * + bean.get(0).getField1() + " " + bean.get(0).getField2(); }
+     */
+
+    public String getGreetingsBBean(BBean bean) {
+        return "Hello " + bean.getField1() + " " + bean.getField2();
+    }
+
+    public String getGreetingsCBean(CBean bean) {
+        return "Hello " + bean.getField1() + " " + bean.getField2();
     }
-    */
+    
+    public String getGreetingsDBean(DBean bean) {
+        return "Hello " + bean.getField1() + " " + bean.getField2() + " "
+                + bean.getField3().getField1() + " "
+                + bean.getField3().getField2();
+    }    
 }

Modified: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java (original)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java Fri Oct  9 08:49:49 2009
@@ -18,13 +18,19 @@
  */
 package helloworld;
 
-import java.util.Vector;
+import javax.jws.WebService;
 
 import org.osoa.sca.annotations.Remotable;
 
+import yetanotherpackage.DBean;
+
+import anotherpackage.BBean;
+import anotherpackage.CBean;
+
 /**
  * This is the business interface of the HelloWorld greetings service.
  */
+@WebService
 @Remotable
 public interface HelloWorldService {
 
@@ -32,5 +38,8 @@
     public String getGreetingsBean(ABean bean);
     public String getGreetingsBeanArray(ABean[] bean);
     //public String getGreetingsBeanVector(Vector<ABean> bean);
+    public String getGreetingsBBean(BBean bean);
+    public String getGreetingsCBean(CBean bean);
+    public String getGreetingsDBean(DBean bean);
 }
 

Added: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite?rev=823459&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite (added)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite Fri Oct  9 08:49:49 2009
@@ -0,0 +1,43 @@
+<?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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+        xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
+	targetNamespace="http://helloworld"
+	xmlns:hw="http://helloworld"
+    name="helloworldws">
+    
+    <component name="HelloWorldClientComponent1">
+        <implementation.java class="helloworld.HelloWorldClientImpl" />
+        <service name="HelloWorldService">
+            <binding.sca/>
+        </service>
+        <reference name="hwService">
+            <binding.ws uri="http://L3AW203:8085/HelloWorldServiceComponent1"/>
+        </reference>
+    </component>    
+
+    <component name="HelloWorldServiceComponent1">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+	    <service name="HelloWorldService">
+            <binding.ws uri="http://L3AW203:8085/HelloWorldServiceComponent1"/>
+        </service>
+    </component>
+    
+</composite>

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/helloworld1.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl?rev=823459&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl (added)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl Fri Oct  9 08:49:49 2009
@@ -0,0 +1,343 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+	<!--
+		* 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.
+	-->
+
+	<!--
+		Generated by pointing a browser at
+		http://l3aw203:8085/HelloWorldServiceComponent1?wsdl
+	-->
+	<!-- but with manual changes to introduce the JMS configuration -->
+
+<wsdl:definitions name="HelloWorldServiceService"
+	targetNamespace="http://helloworld/" xmlns="http://helloworld/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+	xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:SOAP11="http://schemas.xmlsoap.org/wsdl/soap/">
+	<wsdl:types>
+		<xs:schema attributeFormDefault="qualified"
+			elementFormDefault="unqualified" targetNamespace="http://helloworld/"
+			xmlns:ns0="http://test" xmlns:tns="http://helloworld/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+			<xs:import namespace="http://test" />
+			<xs:element name="getGreetingsBean">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="arg0" nillable="true"
+							type="ns0:aBean" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsDBean">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="arg0" nillable="true"
+							type="tns:dBean" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetings">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="arg0" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsCBean">
+				<xs:complexType>
+					<xs:sequence/>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsDBeanResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsCBeanResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsBBean">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="arg0" nillable="true"
+							type="tns:bBean" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsBeanResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsBeanArrayResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsBBeanResponse">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element minOccurs="0" name="return" nillable="true"
+							type="xs:string" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:element name="getGreetingsBeanArray">
+				<xs:complexType>
+					<xs:sequence>
+						<xs:element maxOccurs="unbounded" minOccurs="0" name="arg0"
+							nillable="true" type="ns0:aBean" />
+					</xs:sequence>
+				</xs:complexType>
+			</xs:element>
+			<xs:complexType name="bBean">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="field1" type="xs:string" />
+					<xs:element minOccurs="0" name="field2" type="xs:string" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType name="dBean">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="field1" type="xs:string" />
+					<xs:element minOccurs="0" name="field2" type="xs:string" />
+					<xs:element minOccurs="0" name="field3" type="tns:bBean" />
+				</xs:sequence>
+			</xs:complexType>
+		</xs:schema>
+		<xs:schema targetNamespace="http://test" version="1.0"
+			xmlns:__nnns="http://helloworld/" xmlns:tns="http://test"
+			xmlns:xs="http://www.w3.org/2001/XMLSchema">
+			<xs:import namespace="http://helloworld/" />
+			<xs:complexType name="aBean">
+				<xs:sequence>
+					<xs:element minOccurs="0" name="field1" type="xs:string" />
+					<xs:element minOccurs="0" name="field2" type="xs:string" />
+					<xs:element minOccurs="0" name="field3" type="__nnns:bBean" />
+				</xs:sequence>
+			</xs:complexType>
+			<xs:complexType final="#all" name="aBeanArray">
+				<xs:sequence>
+					<xs:element maxOccurs="unbounded" minOccurs="0" name="item"
+						nillable="true" type="tns:aBean" />
+				</xs:sequence>
+			</xs:complexType>
+		</xs:schema>
+	</wsdl:types>
+	<wsdl:message name="getGreetingsBean">
+		<wsdl:part name="getGreetingsBean" element="getGreetingsBean">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsDBean">
+		<wsdl:part name="getGreetingsDBean" element="getGreetingsDBean">
+
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetings">
+		<wsdl:part name="getGreetings" element="getGreetings">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsCBean">
+		<wsdl:part name="getGreetingsCBean" element="getGreetingsCBean">
+		</wsdl:part>
+
+	</wsdl:message>
+	<wsdl:message name="getGreetingsDBeanResponse">
+		<wsdl:part name="getGreetingsDBeanResponse" element="getGreetingsDBeanResponse">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsCBeanResponse">
+		<wsdl:part name="getGreetingsCBeanResponse" element="getGreetingsCBeanResponse">
+		</wsdl:part>
+	</wsdl:message>
+
+	<wsdl:message name="getGreetingsBBean">
+		<wsdl:part name="getGreetingsBBean" element="getGreetingsBBean">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsResponse">
+		<wsdl:part name="getGreetingsResponse" element="getGreetingsResponse">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsBeanResponse">
+
+		<wsdl:part name="getGreetingsBeanResponse" element="getGreetingsBeanResponse">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsBeanArrayResponse">
+		<wsdl:part name="getGreetingsBeanArrayResponse" element="getGreetingsBeanArrayResponse">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsBBeanResponse">
+		<wsdl:part name="getGreetingsBBeanResponse" element="getGreetingsBBeanResponse">
+
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="getGreetingsBeanArray">
+		<wsdl:part name="getGreetingsBeanArray" element="getGreetingsBeanArray">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:portType name="HelloWorldService">
+		<wsdl:operation name="getGreetings">
+			<wsdl:input message="getGreetings">
+
+			</wsdl:input>
+			<wsdl:output message="getGreetingsResponse">
+			</wsdl:output>
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsDBean">
+			<wsdl:input message="getGreetingsDBean">
+			</wsdl:input>
+			<wsdl:output message="getGreetingsDBeanResponse">
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBean">
+			<wsdl:input message="getGreetingsBean">
+			</wsdl:input>
+			<wsdl:output message="getGreetingsBeanResponse">
+			</wsdl:output>
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBeanArray">
+			<wsdl:input message="getGreetingsBeanArray">
+
+			</wsdl:input>
+			<wsdl:output message="getGreetingsBeanArrayResponse">
+			</wsdl:output>
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBBean">
+			<wsdl:input message="getGreetingsBBean">
+			</wsdl:input>
+			<wsdl:output message="getGreetingsBBeanResponse">
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsCBean">
+			<wsdl:input message="getGreetingsCBean">
+			</wsdl:input>
+			<wsdl:output message="getGreetingsCBeanResponse">
+			</wsdl:output>
+		</wsdl:operation>
+	</wsdl:portType>
+	<wsdl:binding name="HelloWorldServiceBinding" type="HelloWorldService">
+
+		<SOAP:binding style="document"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+		<wsdl:operation name="getGreetings">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsDBean">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBean">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBeanArray">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsBBean">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+		<wsdl:operation name="getGreetingsCBean">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+
+		</wsdl:operation>
+	</wsdl:binding>
+
+	<wsdl:binding name="HelloWorldJmsBinding" type="HelloWorldService">
+		<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/jms" />
+		<wsdl:operation name="getGreetings">
+			<SOAP:operation />
+			<wsdl:input>
+				<SOAP:body use="literal" />
+			</wsdl:input>
+
+			<wsdl:output>
+				<SOAP:body use="literal" />
+			</wsdl:output>
+		</wsdl:operation>
+
+	</wsdl:binding>
+
+	<wsdl:service name="HelloWorldService">
+		<wsdl:port name="HelloWorldJmsPort" binding="HelloWorldJmsBinding">
+			<SOAP:address
+				location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:51293" />
+		</wsdl:port>
+		<wsdl:port name="HelloWorldServicePort" binding="HelloWorldServiceBinding">
+			<SOAP:address location="http://l3aw203:8085/HelloWorldServiceComponent1" />
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>    

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/main/resources/wsdl/HelloWorldService_TuscanyGen.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java?rev=823459&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java (added)
+++ tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java Fri Oct  9 08:49:49 2009
@@ -0,0 +1,122 @@
+/*
+ * 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 helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import yetanotherpackage.DBean;
+
+import anotherpackage.BBean;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class HttpTransportTestCase{
+
+    private SCADomain scaDomain;
+
+    @Before
+	public void startServer() throws Exception {
+            scaDomain = SCADomain.newInstance("helloworld1.composite");
+	}
+    
+    @Ignore
+    @Test
+    public void testWaitForInput() {
+        System.out.println("Press a key to end");
+        try {
+            System.in.read();
+        } catch (Exception ex) {
+        }
+        System.out.println("Shutting down");
+    }    
+    
+    @Test
+    public void testComponent1SCA() throws IOException {
+        HelloWorldService helloWorldService = scaDomain.getService(HelloWorldService.class, "HelloWorldServiceComponent1/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        HelloWorldService helloWorldClient = scaDomain.getService(HelloWorldService.class, "HelloWorldClientComponent1/HelloWorldService");
+        assertNotNull(helloWorldClient);        
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+        assertEquals("Hello Hello Smith", helloWorldClient.getGreetings("Smith"));
+        
+        BBean bbean = new BBean();
+        bbean.setField1("1");
+        bbean.setField2("2");
+        
+        DBean abean = new DBean();
+        abean.setField1("3");
+        abean.setField2("4");
+        abean.setField3(bbean);
+            
+        assertEquals("Hello Hello 3 4 1 2", helloWorldClient.getGreetingsDBean(abean));
+    }
+        
+    @Test
+    public void testComponent1JAXWS() throws IOException {        
+        
+        // talk to the service using JAXWS with WSDL generated from this service used wsgen
+        // the idea here is to demonstrate that the service is providing a JAXWS compliant 
+        // interface
+        QName serviceName = new QName("http://helloworld/", "HelloWorldImplService");
+        URL wsdlLocation = this.getClass().getClassLoader().getResource("wsdl/HelloWorldImplService.wsdl");
+        Service webService = Service.create( wsdlLocation, serviceName );
+        HelloWorldService wsProxy = (HelloWorldService) webService.getPort(HelloWorldService.class);
+
+        assertEquals("Hello Fred", wsProxy.getGreetings("Fred"));
+        
+        BBean bbean = new BBean();
+        bbean.setField1("1");
+        bbean.setField2("2");
+        
+        DBean abean = new DBean();
+        abean.setField1("3");
+        abean.setField2("4");
+        abean.setField3(bbean);
+        
+        assertEquals("Hello 3 4 1 2", wsProxy.getGreetingsDBean(abean));
+        
+       // repeat the JAXWS call with WSDL generated by tuscany
+        
+    }      
+
+	@After
+	public void stopServer() throws Exception {
+            if (scaDomain != null) {
+                scaDomain.close();
+            }
+	}
+
+}

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.5.2/itest/wsdlgen/src/test/java/helloworld/HttpTransportTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: tuscany/branches/sca-java-1.5.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java (original)
+++ tuscany/branches/sca-java-1.5.2/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java Fri Oct  9 08:49:49 2009
@@ -22,6 +22,7 @@
 import java.lang.reflect.Method;
 import java.net.URI;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -47,6 +48,12 @@
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.databinding.DataBinding;
@@ -72,10 +79,13 @@
 import org.apache.tuscany.sca.monitor.impl.ProblemImpl;
 import org.apache.tuscany.sca.xsd.XSDFactory;
 import org.apache.tuscany.sca.xsd.XSDefinition;
+import org.apache.tuscany.sca.xsd.impl.XSDefinitionImpl;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
+import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaException;
 import org.apache.ws.commons.schema.utils.NamespaceMap;
+import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
@@ -330,7 +340,7 @@
         binding.setUndefined(false);
         definition.addBinding(binding);
         wsdlDefinition.setBinding(binding);
-
+        
         // call each helper in turn to populate the wsdl.types element
         XmlSchemaCollection schemaCollection = new XmlSchemaCollection(); 
 
@@ -340,12 +350,14 @@
                 continue;
             }
             List<XSDefinition> xsDefinitions = helper.getSchemaDefinitions(xsdFactory, resolver, en.getValue());
+            
             for (XSDefinition xsDef: xsDefinitions) {
-                // TUSCANY-2757 and TUSCANY-3267 - flip global wrapper elements with nillable 
-                // set true to be set to false.  The JAXB RI seems to be generating this setting
-                // incorrectly according to the JAXB spec.
+
                 Document doc = xsDef.getDocument();
-                if (doc != null) {
+                if (doc != null) {                    
+                    // TUSCANY-2757 and TUSCANY-3267 - flip global wrapper elements with nillable 
+                    // set true to be set to false.  The JAXB RI seems to be generating this setting
+                    // incorrectly according to the JAXB spec.                    
                     NodeList nodes = doc.getFirstChild().getChildNodes();
                     for (int i = 0; i < nodes.getLength(); i++) {
                         Node aNode = nodes.item(i);
@@ -364,7 +376,9 @@
                         }
                     }
                 }
-                addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
+                
+                loadXSD(schemaCollection, xsDef);
+                wsdlDefinition.getXmlSchemas().add(xsDef);
             }
         }
 
@@ -374,6 +388,8 @@
                 wrappers.remove(wrapperName);
             }
         }
+        
+        schemaCollection = new XmlSchemaCollection(); 
 
         // generate schema elements for wrappers that aren't defined in the schemas
         if (wrappers.size() > 0) {
@@ -390,25 +406,41 @@
                     schemaDoc = xsDef.getDocument();
                     schema = schemaDoc.getDocumentElement();
                 } else {
-                    schemaDoc = createDocument();
-                    schema = schemaDoc.createElementNS(SCHEMA_NS, "xs:schema");
-                    // The elementFormDefault should be set to unqualified, see TUSCANY-2388
-                    schema.setAttribute("elementFormDefault", "unqualified");
-                    schema.setAttribute("attributeFormDefault", "qualified");
-                    schema.setAttribute("targetNamespace", targetNS);
-                    schema.setAttributeNS(XMLNS_NS, "xmlns:xs", SCHEMA_NS);
-                    schemaDoc.appendChild(schema);
-                    Schema schemaExt = createSchemaExt(definition);
-                    schemaExt.setElement(schema);
-                    prefixMaps.put(schema, new HashMap<String, String>());
-                    xsDef = xsdFactory.createXSDefinition();
-                    xsDef.setUnresolved(true);
-                    xsDef.setNamespace(targetNS);
-                    xsDef.setDocument(schemaDoc);
-                    // TUSCANY-2465: Set the system id to avoid schema conflict
-                    xsDef.setLocation(URI.create("xsd_" + index + ".xsd"));
-                    index++;
-                    wrapperXSDs.put(targetNS, xsDef);
+                    xsDef = wsdlDefinition.getSchema(targetNS);
+                    if (xsDef != null) {
+                        schemaDoc = xsDef.getDocument();
+                        schema = schemaDoc.getDocumentElement();
+                        wrapperXSDs.put(targetNS, xsDef);
+                        Map<String, String> prefixMap = prefixMaps.get(schema);
+                        if (prefixMap == null){
+                            prefixMap = new HashMap<String, String>();
+                            prefixMaps.put(schema, prefixMap);
+                            String [] prefixes = xsDef.getSchema().getNamespaceContext().getDeclaredPrefixes();
+                            for (int j = 0; j < prefixes.length; j++){
+                                prefixMap.put(xsDef.getSchema().getNamespaceContext().getNamespaceURI(prefixes[j]),
+                                              prefixes[j]);
+                            }
+                        }                        
+                    } else {
+                        schemaDoc = createDocument();
+                        schema = schemaDoc.createElementNS(SCHEMA_NS, "xs:schema");
+                        // The elementFormDefault should be set to unqualified, see TUSCANY-2388
+                        schema.setAttribute("elementFormDefault", "unqualified");
+                        schema.setAttribute("attributeFormDefault", "qualified");
+                        schema.setAttribute("targetNamespace", targetNS);
+                        schema.setAttributeNS(XMLNS_NS, "xmlns:xs", SCHEMA_NS);
+                        schema.setAttributeNS(XMLNS_NS, "xmlns:tns", targetNS);
+                        schemaDoc.appendChild(schema);
+                        prefixMaps.put(schema, new HashMap<String, String>());
+                        xsDef = xsdFactory.createXSDefinition();
+                        xsDef.setUnresolved(true);
+                        xsDef.setNamespace(targetNS);
+                        xsDef.setDocument(schemaDoc);
+                        // TUSCANY-2465: Set the system id to avoid schema conflict
+                        xsDef.setLocation(URI.create("xsd_" + index + ".xsd"));
+                        index++;
+                        wrapperXSDs.put(targetNS, xsDef);
+                    }  
                 }
                 Element wrapper = schemaDoc.createElementNS(SCHEMA_NS, "xs:element");
                 schema.appendChild(wrapper);
@@ -429,6 +461,9 @@
                         String prefix = prefixMap.get(nsURI);
                         if (prefix == null) {
                             prefix = "ns" + i++;
+                            while(prefixMap.containsValue(prefix)){
+                                prefix = "ns" + i++;
+                            }
                             prefixMap.put(nsURI, prefix);
                             schema.setAttributeNS(XMLNS_NS, "xmlns:" + prefix, nsURI);
                             addSchemaImport(schema, nsURI, schemaDoc);
@@ -467,6 +502,9 @@
 									    prefix = "tns";
 									} else {
                                         prefix = "ns" + i++;
+                                        while(prefixMap.containsValue(prefix)){
+                                            prefix = "ns" + i++;
+                                        }
                                         addSchemaImport(schema, nsURI, schemaDoc);
 									}
                                     prefixMap.put(nsURI, prefix);
@@ -482,14 +520,231 @@
  
             // resolve XSDefinitions containing generated wrappers
             for (XSDefinition xsDef: wrapperXSDs.values()) {
+                if (wsdlDefinition.getSchema(xsDef.getNamespace()) == null) {
+                     wsdlDefinition.getXmlSchemas().add(xsDef);
+                }
+                
+                xsDef.setSchema(null);
+                xsDef.setSchemaCollection(null);
                 loadXSD(schemaCollection, xsDef);
-                wsdlDefinition.getXmlSchemas().add(xsDef);
             }
         }
-
+        
+        XSDefinition noNamespaceSchema = null;
+        XSDefinition defaultNamespaceSchema = null;     
+
+        for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()) {
+            // only apply these changes if we have a DOM to work with
+            // this will generally come from the JAXB generation. SDO
+            // just goes straight to generating XmlSchema structures
+            Document doc = xsDef.getDocument();
+            if (doc != null) {
+                // TUSCANY-3283 find any schema that has been generated without a namespace
+                //              and any schema using the default WSDL schema so that we can
+                //              merge the two together              
+                if (xsDef.getNamespace().equals("")){
+                    noNamespaceSchema = xsDef;
+                }
+                if (xsDef.getNamespace().equals(namespaceURI)){
+                    defaultNamespaceSchema = xsDef;
+                } 
+            }
+        }     
+        
+        // TUSCANY-3283 merge the no namespace schema into the default namespace schema
+        if (noNamespaceSchema != null && defaultNamespaceSchema != null){
+            // remove the no namespace schema from our list of schema
+            wsdlDefinition.getXmlSchemas().remove(noNamespaceSchema);
+            // merge the schema with no namespace into the schema with the default namspace for this WSDL
+            mergeSchema(noNamespaceSchema, defaultNamespaceSchema, wsdlDefinition.getXmlSchemas());
+            
+            schemaCollection = new XmlSchemaCollection();
+            defaultNamespaceSchema.setSchema(null);
+            defaultNamespaceSchema.setSchemaCollection(null);
+            loadXSD(schemaCollection, defaultNamespaceSchema);
+        }        
+        
+        // push the schema into the WSDL 
+        for (XSDefinition xsDef: wsdlDefinition.getXmlSchemas()){
+            addSchemaExtension(xsDef, schemaCollection, wsdlDefinition, definition);
+        }
+        
+        // useful for debugging DOM issues
+        //System.out.println("======================= Schema DOM =======================" );
+        //for (XSDefinition xsDef : wsdlDefinition.getXmlSchemas()) {
+        //    if (xsDef.getDocument() != null) {
+        //        printDOM(xsDef.getDocument());
+        //    }
+        //}        
+        
         return definition;
+    }        
+   
+    /**
+     * TUSCANY-3283 
+     * Merge the no namespace schema into the defualt namespace schema
+     * Relies on being called just after the getSchemaDefinitions call when the XSDefinitions 
+     * have only the DOM information set
+     * 
+     * @param noNamespaceSchema
+     * @param defaultNamespaceSchema
+     * @param xsDefinitions
+     */
+    private void mergeSchema(XSDefinition noNamespaceSchema, XSDefinition defaultNamespaceSchema, Collection<XSDefinition> xsDefinitions){
+        Document fromDoc = noNamespaceSchema.getDocument();
+        Document toDoc = defaultNamespaceSchema.getDocument();
+          
+        // merge namespace definitions from the nonamespace schema into the default namespace schema
+        for(int i = 0; i < fromDoc.getDocumentElement().getAttributes().getLength(); i++){
+            Attr attribute = (Attr)fromDoc.getDocumentElement().getAttributes().item(i);
+            String attribName = attribute.getName();
+            if (attribName.startsWith("xmlns:")){
+                
+                String fromPrefix = attribName.substring(attribName.indexOf(":") + 1);
+                
+                if (fromPrefix.equals("xs") != true){        
+                    // create a new namespace prefix to prevent clashes
+                    toDoc.getDocumentElement().setAttributeNS("http://www.w3.org/2000/xmlns/", 
+                                                              "xmlns:__" + fromPrefix, 
+                                                              attribute.getValue());
+                    
+                    // fix up any references to the existing namespace prefix
+                    fixUpNoNamespaceNamespaces(fromDoc, fromPrefix);
+                }
+            }
+        }
+        
+        Node toDocFirstChild = toDoc.getDocumentElement().getFirstChild();
+        
+        // merge types from the no namespace schema into the default namespace schema
+        for(int i = 0; i < fromDoc.getDocumentElement().getChildNodes().getLength(); i++){
+            // merge the DOM types
+            Node node = fromDoc.getDocumentElement().getChildNodes().item(i);
+            Node newNode = toDoc.importNode(node, true);
+            
+            if (newNode.getLocalName() != null && 
+                (newNode.getLocalName().equals("import") || 
+                 newNode.getLocalName().equals("include") ||
+                 newNode.getLocalName().equals("redefine") ||
+                 newNode.getLocalName().equals("annotation") )){
+            	toDoc.getDocumentElement().insertBefore(newNode, toDocFirstChild);
+            } else {
+            	toDoc.getDocumentElement().appendChild(newNode);
+            }
+        }
+        
+        // fix up any references to the types we've just moved
+        for(int i = 0; i < fromDoc.getDocumentElement().getChildNodes().getLength(); i++){
+            Node node = fromDoc.getDocumentElement().getChildNodes().item(i);
+            
+            // correct any references to no name types in other schema
+            if (node.getLocalName() != null && 
+                node.getLocalName().equals("complexType")){
+                Node typeName = node.getAttributes().getNamedItem("name");
+                fixUpNoNamespaceReferences(xsDefinitions, typeName.getNodeValue(), defaultNamespaceSchema.getNamespace());
+            }
+        }
+    }
+    
+    /**
+     * TUSCANY-3283 
+     * Correct any namespace prefixes in the no namespace schema to prevent them from 
+     * clashing when the no namespace schema is merged with the default schema
+     * 
+     * @param fromSchema
+     * @param fromPrefix
+     * @param toPrefix
+     */   
+    private void fixUpNoNamespaceNamespaces(Document fromSchema, String fromPrefix){
+        NodeList elements = fromSchema.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema","element");
+        for (int k = 0; k < elements.getLength(); k++){
+            Element element = (Element) elements.item(k);
+            if (element != null && element.getAttributes() != null) {
+                Node type = element.getAttributes().getNamedItem("type");
+                
+                if (type != null &&
+                    type.getNodeValue().startsWith(fromPrefix)){
+                    type.setNodeValue("__" + type.getNodeValue());
+               }
+            }
+        }
     }
 
+    /**
+     * TUSCANY-3283 
+     * Correct any references in the schema list that used to point to types in the
+     * no namespace schema
+     * 
+     * @param fromSchema
+     * @param toSchema
+     */  
+    private void fixUpNoNamespaceReferences(Collection<XSDefinition> xsDefinitions, String typeName, String defaultNamespace){
+        
+        // fix up any references in any other schema that points to this type
+        for (XSDefinition xsDef: xsDefinitions) {
+
+        	if (xsDef.getDocument() != null){
+	            // look for any imports of the no namespace schema
+	            Document refSchema = xsDef.getDocument();
+	            NodeList imports = refSchema.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema","import");
+	            
+	            for (int j = 0; j < imports.getLength(); j++){
+	                Element _import = (Element)imports.item(j);
+	                
+	                // Fix up the import
+	                if (_import.getAttributes().getLength() == 0){
+	                    if (xsDef.getNamespace().equals(defaultNamespace)){
+	                        // remove the import
+	                        _import.getParentNode().removeChild(_import);                        
+	                    } else {
+	                        // update the import to refer to the default namespace
+	                        _import.setAttribute("namespace", defaultNamespace);
+	                    }
+	                }
+	            }
+	
+	            // look for any type attributes that refer to the 
+	            // node being merged
+	            NodeList elements = refSchema.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema","element");
+	            for (int k = 0; k < elements.getLength(); k++){
+	                Element element = (Element) elements.item(k);
+	                if (element != null && element.getAttributes() != null) {
+	                    Node type = element.getAttributes().getNamedItem("type");
+	                    
+	                    if (type != null &&
+	                        type.getNodeValue().equals(typeName)){
+	                        if (xsDef.getNamespace().equals(defaultNamespace)){
+	                            // just add "tns" in front of the type name as
+	                            // we have merged the type into this schema
+	                            type.setNodeValue("tns:" + type.getNodeValue());
+	                        } else {
+	                            // add a namespace 
+	                            refSchema.getDocumentElement().setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:__nnns", defaultNamespace);
+	
+	                            // prefix the type name with the namespace
+	                            type.setNodeValue("__nnns:" + type.getNodeValue());
+	                        }
+	                    }
+	                }
+	            }
+        	}
+        }
+    }
+
+    /*
+     * Just used when debugging DOM problems
+     */
+    private void printDOM(Document document){
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            Source source = new DOMSource(document);
+            Result result = new StreamResult(System.out);
+            transformer.transform(source, result);
+        } catch (Exception ex){
+            ex.toString();
+        }
+    }
+    
     private static void addSchemaImport(Element schema, String nsURI, Document schemaDoc) {
         Element imp = schemaDoc.createElementNS(SCHEMA_NS, "xs:import");
         if (!"".equals(nsURI)) {
@@ -548,8 +803,8 @@
                     throw new RuntimeException(e);
                 }
             }
-            loadXSD(schemaCollection, xsDef);
-            wsdlDefinition.getXmlSchemas().add(xsDef);
+            //loadXSD(schemaCollection, xsDef);
+            //wsdlDefinition.getXmlSchemas().add(xsDef);
             Element schema = document.getDocumentElement();
             Schema schemaExt = createSchemaExt(definition);
             schemaExt.setDocumentBaseURI(document.getDocumentURI());

Modified: tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java (original)
+++ tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java Fri Oct  9 08:49:49 2009
@@ -137,4 +137,12 @@
      * @param binding the WSDL binding
      */
     void setBinding(Binding binding);
+    
+    /**
+     * Find the schema definition for the provided namespace
+     * 
+     * @param namespace
+     * @return the schema definition relating to the provided namespace or null if not found
+     */
+    XSDefinition getSchema(String namespace);
 }

Modified: tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
URL: http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java?rev=823459&r1=823458&r2=823459&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (original)
+++ tuscany/branches/sca-java-1.5.2/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java Fri Oct  9 08:49:49 2009
@@ -285,5 +285,15 @@
     public void setBinding(Binding binding) {
         this.binding = binding;
     }
+    
+    public XSDefinition getSchema(String namespace){
+        for (XSDefinition xsDef : schemas){
+            if (xsDef.getNamespace().equals(namespace)){
+                return xsDef;
+            }
+        }
+        
+        return null;
+    }
 
 }