You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2008/04/24 23:20:21 UTC

svn commit: r651426 - in /incubator/tuscany/java/sca: modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/ modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/ modules/interface-java-jaxws/src/ma...

Author: nash
Date: Thu Apr 24 14:20:08 2008
New Revision: 651426

URL: http://svn.apache.org/viewvc?rev=651426&view=rev
Log:
Support WSDL-less deployment of Java service interfaces containing JAX-WS annotations

Added:
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaClass.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaInterface.java
    incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/
    incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/
    incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/
    incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java
Removed:
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/TestJavaInterface.java
Modified:
    incubator/tuscany/java/sca/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
    incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
    incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
    incubator/tuscany/java/sca/samples/zipcode-jaxws/pom.xml
    incubator/tuscany/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite

Modified: incubator/tuscany/java/sca/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws/src/main/java/org/apache/tuscany/sca/binding/ws/impl/WebServiceBindingImpl.java Thu Apr 24 14:20:08 2008
@@ -115,6 +115,11 @@
     }
 
     public Binding getBinding() {
+        if (binding == null) {
+            if (getWSDLDefinition() != null && wsdlDefinition.getBinding() != null) {
+                binding = wsdlDefinition.getBinding();
+            }
+        }
         return binding;
     }
 

Modified: incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/core-databinding/src/main/java/org/apache/tuscany/sca/core/databinding/processor/DataBindingJavaInterfaceProcessor.java Thu Apr 24 14:20:08 2008
@@ -85,6 +85,9 @@
                 continue;
             }
             Operation operation = opMap.get(method.getName());
+            if (operation == null) {  // @WebMethod exclude=true
+                continue;
+            }
             DataBinding methodDataBinding = clazz.getAnnotation(DataBinding.class);
             if (methodDataBinding == null) {
                 methodDataBinding = dataBinding;

Modified: incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java-jaxws/src/main/java/org/apache/tuscany/sca/interfacedef/java/jaxws/JAXWSJavaInterfaceProcessor.java Thu Apr 24 14:20:08 2008
@@ -45,6 +45,7 @@
 import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
 import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceVisitor;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
 import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
 
@@ -55,6 +56,7 @@
  */
 public class JAXWSJavaInterfaceProcessor implements JavaInterfaceVisitor {
     private static final String JAXB_DATABINDING = "javax.xml.bind.JAXBElement";
+    private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
     private FaultExceptionMapper faultExceptionMapper;
 
     public JAXWSJavaInterfaceProcessor(FaultExceptionMapper faultExceptionMapper) {
@@ -71,8 +73,11 @@
         Class<?> clazz = contract.getJavaClass();
         WebService webService = clazz.getAnnotation(WebService.class);
         String tns = JavaInterfaceUtil.getNamespace(clazz);
+        String localName = clazz.getSimpleName();
         if (webService != null) {
             tns = getValue(webService.targetNamespace(), tns);
+            localName = getValue(webService.name(), localName);
+            contract.setQName(new QName(tns, localName));
             // Mark SEI as Remotable
             contract.setRemotable(true);
         }
@@ -114,6 +119,7 @@
                 }
                 operationName = getValue(webMethod.operationName(), operationName);
                 operation.setName(operationName);
+                operation.setAction(webMethod.action());
             }
 
             // Is one way?
@@ -197,8 +203,8 @@
                     if (logical instanceof XMLType) {
                         ((XMLType)logical).setElementName(element);
                     }
+                    outputElements.add(new ElementInfo(element, null));
                 }
-                outputElements.add(new ElementInfo(element, null));
 
                 WrapperInfo wrapperInfo =
                     new WrapperInfo(JAXB_DATABINDING, new ElementInfo(inputWrapper, null),

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaInterface.java Thu Apr 24 14:20:08 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.tuscany.sca.interfacedef.java;
 
+import javax.xml.namespace.QName;
 import org.apache.tuscany.sca.assembly.Base;
 import org.apache.tuscany.sca.interfacedef.Interface;
 
@@ -41,6 +42,20 @@
      * @param className the name of the Java interface class
      */
     void setName(String className);
+
+    /**
+     * Returns the QName of the JAX-WS interface.
+     *
+     * @return the QName of the JAX-WS interface
+     */
+    QName getQName();
+
+    /**
+     * Sets the QName of the JAX-WS interface.
+     *
+     * @param interfaceName the QName of the JAX-WS interface
+     */
+    void setQName(QName interfaceName);
 
     /**
      * Returns the Java interface class.

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/JavaOperation.java Thu Apr 24 14:20:08 2008
@@ -42,4 +42,16 @@
      */
     void setJavaMethod(Method method);
 
+    /**
+     * Returns the JAX-WS @WebMethod action parameter.
+     * @return the action value
+     */
+    String getAction();
+    
+    /**
+     * Sets the JAX-WS @WebMethod action parameter.
+     * @param action the action value
+     */
+    void setAction(String action);
+
 }

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaInterfaceImpl.java Thu Apr 24 14:20:08 2008
@@ -18,6 +18,7 @@
  */
 package org.apache.tuscany.sca.interfacedef.java.impl;
 
+import javax.xml.namespace.QName;
 import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 
@@ -31,6 +32,7 @@
     private String className;
     private Class<?> javaClass;
     private Class<?> callbackClass;
+    private QName qname;
     
     protected JavaInterfaceImpl() {
     }
@@ -50,6 +52,14 @@
             throw new IllegalStateException();
         }
         this.className = className;
+    }
+
+    public QName getQName() {
+        return qname;
+    }
+
+    public void setQName(QName interfacename) {
+        qname = interfacename;
     }
 
     public Class<?> getJavaClass() {

Modified: incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-java/src/main/java/org/apache/tuscany/sca/interfacedef/java/impl/JavaOperationImpl.java Thu Apr 24 14:20:08 2008
@@ -32,6 +32,7 @@
 public class JavaOperationImpl extends OperationImpl implements JavaOperation {
 
     private Method method;
+    private String action;
 
     public Method getJavaMethod() {
         return method;
@@ -39,6 +40,14 @@
 
     public void setJavaMethod(Method method) {
         this.method = method;
+    }
+
+    public String getAction() {
+        return action;
+    }
+    
+    public void setAction(String action) {
+        this.action = action;
     }
 
     @Override

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/pom.xml Thu Apr 24 14:20:08 2008
@@ -80,6 +80,13 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-core-databinding</artifactId>
+            <version>2.0-incubating-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
             <groupId>commons-codec</groupId>
             <artifactId>commons-codec</artifactId>
             <version>1.3</version>

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Interface2WSDLGenerator.java Thu Apr 24 14:20:08 2008
@@ -19,8 +19,15 @@
 
 package org.apache.tuscany.sca.interfacedef.wsdl.interface2wsdl;
 
+import java.beans.Introspector;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
 import javax.wsdl.Definition;
 import javax.wsdl.Input;
 import javax.wsdl.Message;
@@ -30,19 +37,29 @@
 import javax.wsdl.PortType;
 import javax.wsdl.Types;
 import javax.wsdl.WSDLException;
+import javax.wsdl.extensions.schema.Schema;
 import javax.wsdl.factory.WSDLFactory;
+import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
 
 import org.apache.tuscany.sca.databinding.DataBinding;
 import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint;
+import org.apache.tuscany.sca.databinding.jaxb.JAXBContextHelper;
 import org.apache.tuscany.sca.interfacedef.DataType;
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaOperation;
 import org.apache.tuscany.sca.interfacedef.java.impl.JavaInterfaceUtil;
 import org.apache.tuscany.sca.interfacedef.util.ElementInfo;
+import org.apache.tuscany.sca.interfacedef.util.JavaXMLMapper;
+import org.apache.tuscany.sca.interfacedef.util.TypeInfo;
 import org.apache.tuscany.sca.interfacedef.util.XMLType;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.interfacedef.util.WrapperInfo;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaCollection;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
@@ -50,12 +67,19 @@
 import org.apache.ws.commons.schema.XmlSchemaForm;
 import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 /**
  * @version $Rev$ $Date$
  */
 public class Interface2WSDLGenerator {
+    private static final String SCHEMA_NS = "http://www.w3.org/2001/XMLSchema";
+    private static final String SCHEMA_NAME = "schema";
+    private static final QName SCHEMA_QNAME = new QName(SCHEMA_NS, SCHEMA_NAME);
+
     private WSDLFactory factory;
     private DataBindingExtensionPoint dataBindingExtensionPoint;
     private WSDLDefinitionGenerator definitionGenerator = new WSDLDefinitionGenerator();
@@ -71,7 +95,7 @@
         this.dataBindingExtensionPoint = dataBindingExtensionPoint;
     }
 
-    public Definition generate(Interface interfaze) throws WSDLException {
+    public Definition generate(Interface interfaze, WSDLDefinition wsdlDefinition) throws WSDLException {
         if (interfaze == null) {
             return null;
         }
@@ -85,6 +109,7 @@
         Definition definition = factory.newDefinition();
         definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
         definition.addNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+        definition.addNamespace("xs", SCHEMA_NS);
 
         definition.setTargetNamespace(name.getNamespaceURI());
         definition.setQName(name);
@@ -92,26 +117,150 @@
 
         PortType portType = definition.createPortType();
         portType.setQName(name);
+        Binding binding = definitionGenerator.createBinding(definition, portType);
+        ArrayList<Class> javaTypes = new ArrayList<Class>(); 
+        Map<QName, List<ElementInfo>> wrappers = new HashMap<QName, List<ElementInfo>>();
         for (Operation op : interfaze.getOperations()) {
-            javax.wsdl.Operation operation = generateOperation(definition, op);
+            javax.wsdl.Operation operation = generateOperation(definition, op, javaTypes, wrappers);
             portType.addOperation(operation);
+            String action = ((JavaOperation)op).getAction();
+            BindingOperation bindingOp = definitionGenerator.createBindingOperation(definition, operation, action);
+            binding.addBindingOperation(bindingOp);
         }
         portType.setUndefined(false);
         definition.addPortType(portType);
-        definitionGenerator.createBinding(definition, portType);
+        binding.setUndefined(false);
+        definition.addBinding(binding);
+        wsdlDefinition.setBinding(binding);
+
+        Map<String, Element> schemas = new HashMap<String, Element>();
+        Document schemaDoc = null;
+        if (javaTypes.size() > 0) {
+            try {
+                // generate schema document for all required types
+                Class[] types = new Class[javaTypes.size()];
+                types = javaTypes.toArray(types);
+                JAXBContext context = JAXBContext.newInstance(types);
+                schemaDoc = (Document)JAXBContextHelper.generateSchema(context);
+
+                // create a map entry for each schema in the document
+                NodeList docNodes = schemaDoc.getChildNodes();
+                for (int i = 0; i < docNodes.getLength(); i++) {
+                    Node docNode = docNodes.item(i);
+                    if (docNode.getNodeType() == Node.ELEMENT_NODE &&
+                        SCHEMA_NS.equals(docNode.getNamespaceURI()) &&
+                        SCHEMA_NAME.equals(docNode.getLocalName())) {
+                        Schema schemaExt = createSchemaExt(definition);
+                        schemaExt.setElement((Element)docNode);
+                        String targetNS = ((Element)docNode).getAttribute("targetNamespace");
+                        if (!"".equals(targetNS)) {
+                            schemas.put(targetNS, (Element)docNode);
+                        }
+                    }
+                }
+
+                // remove global wrapper elements from generation list
+                for (Map.Entry<String, Element> entry: schemas.entrySet()) {
+                    String targetNS = entry.getKey();
+                    NodeList childNodes = entry.getValue().getChildNodes();
+                    for (int i = 0; i < childNodes.getLength(); i++) {
+                        Node childNode = childNodes.item(i);
+                        if (childNode.getNodeType() == Node.ELEMENT_NODE) {
+                            String elementName = ((Element)childNode).getAttribute("name");
+                            QName elementQName = new QName(targetNS, elementName); 
+                            wrappers.remove(elementQName);  // it's OK if not found
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        }
 
-        Types types = definitionGenerator.createTypes(definition);
+        // generate schema for any wrappers that weren't generated by JAXB
+        if (wrappers.size() > 0) {
+            for (Map.Entry<QName, List<ElementInfo>> entry: wrappers.entrySet()) {
+                String targetNS = entry.getKey().getNamespaceURI();
+                Element schema = schemas.get(targetNS);
+                if (schema == null) {
+                    if (schemaDoc == null) {
+                        schemaDoc = createDocument();
+                    }
+                    schema = schemaDoc.createElementNS(SCHEMA_NS, "xs:schema");
+                    schema.setAttribute("elementFormDefault", "qualified");
+                    schema.setAttribute("attributeFormDefault", "qualified");
+                    schema.setAttribute("targetNamespace", targetNS);
+                    schema.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xs", SCHEMA_NS);
+                    Schema schemaExt = createSchemaExt(definition);
+                    schemaExt.setElement(schema);
+                    schemas.put(targetNS, schema);
+                }
+                Element wrapper = schemaDoc.createElementNS(SCHEMA_NS, "xs:element");
+                schema.appendChild(wrapper);
+                wrapper.setAttribute("name", entry.getKey().getLocalPart());
+                Element complexType = schemaDoc.createElementNS(SCHEMA_NS, "xs:complexType");
+                wrapper.appendChild(complexType);
+                for (ElementInfo element: entry.getValue()) {
+                    Element xsElement = schemaDoc.createElementNS(SCHEMA_NS, "xs:element"); 
+                    xsElement.setAttribute("minOccurs", "0");
+                    xsElement.setAttribute("name", element.getQName().getLocalPart());
+                    QName typeName = element.getType().getQName();
+                    xsElement.setAttribute("type", typeName.getLocalPart());
+                    complexType.appendChild(xsElement);
+                }
+            }
+        }
 
         return definition;
     }
 
+    private DocumentBuilderFactory documentBuilderFactory;
+
+    public Schema createSchemaExt(Definition definition) throws WSDLException {
+        Types types = definition.getTypes();
+        if (types == null) {
+            types = definition.createTypes();
+            definition.setTypes(types);
+        }
+
+        Schema schemaExt = (Schema)definition.getExtensionRegistry()
+                               .createExtension(Types.class, SCHEMA_QNAME);
+        types.addExtensibilityElement(schemaExt);
+
+        return schemaExt;
+    }
+
+    public Document createDocument() {
+        Document document;
+        try {
+            if (documentBuilderFactory == null) {
+                documentBuilderFactory = DocumentBuilderFactory.newInstance();
+                documentBuilderFactory.setNamespaceAware(true);
+            }
+            document = documentBuilderFactory.newDocumentBuilder().newDocument();
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e);
+        }
+        document.setDocumentURI("http://");
+        return document;
+    }
+
     protected QName getQName(Interface i) {
-        // FIXME: We need to add the name information into the Interface model 
-        Class<?> javaClass = ((JavaInterface)i).getJavaClass();
-        return new QName(JavaInterfaceUtil.getNamespace(javaClass), javaClass.getSimpleName(), "tns");
+        JavaInterface ji = (JavaInterface)i;
+        QName qname = ji.getQName();
+        if (qname != null) {
+            return qname;
+        } else {
+            Class<?> javaClass = ((JavaInterface)i).getJavaClass();
+            return new QName(JavaInterfaceUtil.getNamespace(javaClass), javaClass.getSimpleName(), "tns");
+        }
     }
 
-    public javax.wsdl.Operation generateOperation(Definition definition, Operation op) {
+    public javax.wsdl.Operation generateOperation(Definition definition,
+                                                  Operation op,
+                                                  ArrayList<Class> javaTypes,
+                                                  Map<QName, List<ElementInfo>> wrappers)
+                                              throws WSDLException {
         javax.wsdl.Operation operation = definition.createOperation();
         operation.setName(op.getName());
         operation.setUndefined(false);
@@ -127,7 +276,7 @@
         // FIXME: By default, java interface is mapped to doc-lit-wrapper style WSDL
         if (op.getWrapper() != null) {
             // Generate doc-lit-wrapper style
-            inputMsg.addPart(generateWrapperPart(definition, op, true));
+            inputMsg.addPart(generateWrapperPart(definition, op, javaTypes, wrappers, true));
         } else {
             // Bare style
             int i = 0;
@@ -149,9 +298,9 @@
             definition.addMessage(outputMsg);
 
             if (op.getWrapper() != null) {
-                inputMsg.addPart(generateWrapperPart(definition, op, false));
+                outputMsg.addPart(generateWrapperPart(definition, op, javaTypes, wrappers, false));
             } else {
-                inputMsg.addPart(generatePart(definition, op.getOutputType(), "return"));
+                outputMsg.addPart(generatePart(definition, op.getOutputType(), "return"));
             }
             output.setMessage(outputMsg);
 
@@ -178,19 +327,68 @@
         return part;
     }
 
-    public Part generateWrapperPart(Definition definition, Operation operation, boolean input) {
+    public Part generateWrapperPart(Definition definition,
+                                    Operation operation,
+                                    ArrayList<Class> javaTypes, 
+                                    Map<QName, List<ElementInfo>> wrappers,
+                                    boolean input) throws WSDLException {
         Part part = definition.createPart();
         String partName = input ? operation.getName() : (operation.getName() + "Response");
         part.setName(partName);
-        if (operation.getWrapper() != null) {
+        WrapperInfo opWrapper = operation.getWrapper();
+        if (opWrapper != null) {
             ElementInfo elementInfo =
-                input ? operation.getWrapper().getInputWrapperElement() : operation.getWrapper()
-                    .getOutputWrapperElement();
-            part.setElementName(elementInfo.getQName());
+                input ? opWrapper.getInputWrapperElement() : opWrapper.getOutputWrapperElement();
+            List<ElementInfo> elements =
+                input ? opWrapper.getInputChildElements() : opWrapper.getOutputChildElements();
+            QName wrapperName = elementInfo.getQName();
+            part.setElementName(wrapperName);
+            wrappers.put(wrapperName, elements);
+
+            Method method = ((JavaOperation)operation).getJavaMethod();
+            if (input) {
+                Class<?>[] paramTypes = method.getParameterTypes();
+                for (int i = 0; i < paramTypes.length; i++) {
+                    Object logical = operation.getInputType().getLogical().get(i).getLogical();
+                    TypeInfo typeInfo = getTypeInfo(paramTypes[i], logical);
+                    if (!typeInfo.isSimpleType()) {
+                        javaTypes.add(paramTypes[i]);
+                    }
+                    ElementInfo element = new ElementInfo(elements.get(i).getQName(), typeInfo);
+                    elements.set(i, element);
+                }
+            } else {
+                Class<?> returnType = method.getReturnType();
+                if (returnType != Void.TYPE) {
+                    Object logical = operation.getOutputType().getLogical();
+                    TypeInfo typeInfo = getTypeInfo(returnType, logical);
+                    if (!typeInfo.isSimpleType()) {
+                        javaTypes.add(returnType);
+                    }
+                    ElementInfo element = new ElementInfo(elements.get(0).getQName(), typeInfo);
+                    elements.set(0, element);
+                }
+            }
         }
         return part;
     }
 
+    private TypeInfo getTypeInfo(Class javaType, Object logical) {
+        QName xmlType = JavaXMLMapper.getXMLType(javaType);
+        if (xmlType != null) {
+            return new TypeInfo(xmlType, true, null);
+        } else {
+            if (logical instanceof XMLType) {
+                xmlType = ((XMLType)logical).getTypeName();
+            }
+            if (xmlType == null) {
+                xmlType = new QName(JavaInterfaceUtil.getNamespace(javaType),
+                                    Introspector.decapitalize(javaType.getSimpleName()));
+            }
+            return new TypeInfo(xmlType, false, null);
+        }
+    }
+
     public XmlSchemaType getXmlSchemaType(DataType type) {
         return null;
     }
@@ -204,6 +402,19 @@
         return null;
     }
 
+    // The following method isn't currently used and would need updating to be
+    // usable.  Instead, we generate an inline schema DOM in this class and
+    // convert it to an XMLSchemaCollection when this method returns to
+    // Java2WSDLHelper.  It would be possible for this class to generate the
+    // XMLSchemaCollection and add it to the WSDLDefinition that's passed into
+    // this method.  This doesn't completely remove the need for DOM to
+    // XMLSchemaCollection conversion, because a DOM is produced by the
+    // JAXB schema generator.  We could do that DOM to XMLSchemaCollection
+    // conversion in this class and then add all the schemas generated here
+    // to the XMLSchemaCollection.  This would only be a worthwhile improvement
+    // over the current code if we could omit the inline DOM schemas from the
+    // generated wsdl4j Definition, and I'm not sure about all the implications
+    // of going down this path.
     public void generateWrapperElements(Operation op) {
         XmlSchemaCollection collection = new XmlSchemaCollection();
         String ns = getQName(op.getInterface()).getNamespaceURI();

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/WSDLDefinitionGenerator.java Thu Apr 24 14:20:08 2008
@@ -82,10 +82,6 @@
         soapBinding.setStyle("document");
         soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
         binding.addExtensibilityElement(soapBinding);
-
-        createBindingOperations(definition, binding, portType);
-        binding.setUndefined(false);
-        definition.addBinding(binding);
         return binding;
     }
 
@@ -97,43 +93,40 @@
     }
 
     @SuppressWarnings("unchecked")
-    protected void createBindingOperations(Definition definition, Binding binding, PortType portType)
+    public BindingOperation createBindingOperation(Definition definition, Operation operation, String action)
         throws WSDLException {
-        for (Iterator oi = portType.getOperations().iterator(); oi.hasNext();) {
-            Operation operation = (Operation)oi.next();
-            BindingOperation bindingOperation = definition.createBindingOperation();
-            bindingOperation.setOperation(operation);
-            configureBindingOperation(bindingOperation, operation);
-            SOAPOperation soapOperation =
-                (SOAPOperation)definition.getExtensionRegistry().createExtension(BindingOperation.class, SOAP_OPERATION);
-            soapOperation.setSoapActionURI("");
-            bindingOperation.addExtensibilityElement(soapOperation);
-            if (operation.getInput() != null) {
-                BindingInput bindingInput = definition.createBindingInput();
-                configureBindingInput(bindingInput, operation.getInput());
-                SOAPBody soapBody =
-                    (SOAPBody)definition.getExtensionRegistry().createExtension(BindingInput.class, SOAP_BODY);
-                soapBody.setUse("literal");
-                bindingInput.addExtensibilityElement(soapBody);
-                bindingOperation.setBindingInput(bindingInput);
-            }
-            if (operation.getOutput() != null) {
-                BindingOutput bindingOutput = definition.createBindingOutput();
-                configureBindingOutput(bindingOutput, operation.getOutput());
-                SOAPBody soapBody =
-                    (SOAPBody)definition.getExtensionRegistry().createExtension(BindingOutput.class, SOAP_BODY);
-                soapBody.setUse("literal");
-                bindingOutput.addExtensibilityElement(soapBody);
-                bindingOperation.setBindingOutput(bindingOutput);
-            }
-            for (Iterator fi = operation.getFaults().values().iterator(); fi.hasNext();) {
-                Fault fault = (Fault)fi.next();
-                BindingFault bindingFault = definition.createBindingFault();
-                configureBindingFault(bindingFault, fault);
-                bindingOperation.addBindingFault(bindingFault);
-            }
-            binding.addBindingOperation(bindingOperation);
+        BindingOperation bindingOperation = definition.createBindingOperation();
+        bindingOperation.setOperation(operation);
+        configureBindingOperation(bindingOperation, operation);
+        SOAPOperation soapOperation =
+            (SOAPOperation)definition.getExtensionRegistry().createExtension(BindingOperation.class, SOAP_OPERATION);
+        soapOperation.setSoapActionURI(action);
+        bindingOperation.addExtensibilityElement(soapOperation);
+        if (operation.getInput() != null) {
+            BindingInput bindingInput = definition.createBindingInput();
+            configureBindingInput(bindingInput, operation.getInput());
+            SOAPBody soapBody =
+                (SOAPBody)definition.getExtensionRegistry().createExtension(BindingInput.class, SOAP_BODY);
+            soapBody.setUse("literal");
+            bindingInput.addExtensibilityElement(soapBody);
+            bindingOperation.setBindingInput(bindingInput);
+        }
+        if (operation.getOutput() != null) {
+            BindingOutput bindingOutput = definition.createBindingOutput();
+            configureBindingOutput(bindingOutput, operation.getOutput());
+            SOAPBody soapBody =
+                (SOAPBody)definition.getExtensionRegistry().createExtension(BindingOutput.class, SOAP_BODY);
+            soapBody.setUse("literal");
+            bindingOutput.addExtensibilityElement(soapBody);
+            bindingOperation.setBindingOutput(bindingOutput);
+        }
+        for (Iterator fi = operation.getFaults().values().iterator(); fi.hasNext();) {
+            Fault fault = (Fault)fi.next();
+            BindingFault bindingFault = definition.createBindingFault();
+            configureBindingFault(bindingFault, fault);
+            bindingOperation.addBindingFault(bindingFault);
         }
+        return bindingOperation;
     }
 
     protected void configureBindingOperation(BindingOperation bindingOperation, Operation operation)

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelper.java Thu Apr 24 14:20:08 2008
@@ -67,6 +67,7 @@
 import org.apache.tuscany.sca.interfacedef.wsdl.XSDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.impl.InvalidWSDLException;
 import org.apache.tuscany.sca.interfacedef.wsdl.impl.WSDLOperationIntrospectorImpl;
+import org.apache.tuscany.sca.interfacedef.wsdl.interface2wsdl.Interface2WSDLGenerator;
 import org.apache.tuscany.sca.interfacedef.wsdl.xml.WSDLModelResolver;
 import org.apache.tuscany.sca.interfacedef.wsdl.xml.XMLDocumentHelper;
 import org.apache.ws.commons.schema.XmlSchema;
@@ -114,28 +115,49 @@
      */
     public static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract,
                                                                     boolean requiresSOAP12) {
-        JavaInterface iface = (JavaInterface)contract.getInterface();
-        
-        // Create a package2ns map
-        Map<String, String> pkg2nsMap = new HashMap<String, String>();
-        for (Operation op : iface.getOperations()) {
-            DataType<List<DataType>> inputType = op.getInputType();
-            for (DataType t : inputType.getLogical()) {
-                register(pkg2nsMap, t);
-            }
-            DataType outputType = op.getOutputType();
-            register(pkg2nsMap, outputType);
-        }
-
-        final Definition def = createDefinition(pkg2nsMap, iface.getJavaClass(), requiresSOAP12);
-
         final DefaultWSDLFactory wsdlFactory = new DefaultWSDLFactory();
 
         WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
         WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
-
         wsdlContract.setInterface(wsdlInterface);
-        final WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition();
+
+        final WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
+        JavaInterface iface = (JavaInterface)contract.getInterface();
+        
+        //FIXME: When Interface2WSDLGenerator is fully working, change this code
+        // to use it in all cases instead of calling createDefinition()
+        Definition def = null;
+        if (iface.getQName() == null) {  // plain Java interface 
+            // Create a package2ns map
+            Map<String, String> pkg2nsMap = new HashMap<String, String>();
+            for (Operation op : iface.getOperations()) {
+                DataType<List<DataType>> inputType = op.getInputType();
+                for (DataType t : inputType.getLogical()) {
+                    register(pkg2nsMap, t);
+                }
+                DataType outputType = op.getOutputType();
+                register(pkg2nsMap, outputType);
+            }
+            def = createDefinition(pkg2nsMap, iface.getJavaClass(), requiresSOAP12);
+
+        } else {  // interface with JAX-WS annotations
+            try {
+                Interface2WSDLGenerator wsdlGenerator = new Interface2WSDLGenerator();
+                //FIXME: add support for SOAP 1.2
+                def = wsdlGenerator.generate(iface, wsdlDefinition);
+            } catch (WSDLException e) {
+                throw new RuntimeException(e);
+            }
+ 
+            // temp for debugging
+            // try {
+            //     WSDLWriter writer =  javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
+            //     writer.writeWSDL(def, System.out);
+            // } catch (WSDLException e) {
+            //     throw new RuntimeException(e);
+            // }
+        }
+
         wsdlDefinition.setDefinition(def);
         wsdlInterface.setWsdlDefinition(wsdlDefinition);
         wsdlInterface.setRemotable(true);
@@ -145,11 +167,15 @@
         PortType portType = (PortType)def.getAllPortTypes().values().iterator().next();
         wsdlInterface.setPortType(portType);
 
+        //FIXME: Should Interface2WSDLGenerator create an XmlSchemaCollection so that
+        // there's no need to call readInlineSchemas here?
+        //
         // Allow privileged access to read properties. Requires PropertiesPermission read in
         // security policy.
+        final Definition fdef = def;
         AccessController.doPrivileged(new PrivilegedAction<Object>() {
             public Object run() {
-                readInlineSchemas(wsdlFactory, wsdlDefinition, def, new XmlSchemaCollection());
+                readInlineSchemas(wsdlFactory, wsdlDefinition, fdef, new XmlSchemaCollection());
                 return null;
             }
         });

Added: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaClass.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaClass.java?rev=651426&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaClass.java (added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaClass.java Thu Apr 24 14:20:08 2008
@@ -0,0 +1,26 @@
+/*
+ * 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.tuscany.sca.interfacedef.wsdl;
+
+public class TestJavaClass {
+    public String name;
+    public int number;
+    public float balance;
+}

Added: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaInterface.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaInterface.java?rev=651426&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaInterface.java (added)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/TestJavaInterface.java Thu Apr 24 14:20:08 2008
@@ -0,0 +1,50 @@
+/*
+ * 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.tuscany.sca.interfacedef.wsdl;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+import org.osoa.sca.annotations.OneWay;
+import org.osoa.sca.annotations.Remotable;
+
+@Remotable
+@WebService
+public interface TestJavaInterface {
+    String m1(String str);
+
+    @OneWay
+    @WebMethod
+    void m2(int i);
+
+    @WebMethod
+    String m3();
+
+    void m4();
+
+    @WebMethod
+    String m5(String str, int i);
+
+    @WebMethod(exclude = true)
+    void dummy();
+
+    @WebMethod
+    void m6(TestJavaClass info);
+}

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/interface2wsdl/Java2WSDLGeneratorTestCase.java Thu Apr 24 14:20:08 2008
@@ -24,9 +24,14 @@
 import javax.wsdl.Definition;
 import javax.wsdl.xml.WSDLWriter;
 
+import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.DefaultWSDLFactory;
+import org.apache.tuscany.sca.interfacedef.wsdl.TestJavaInterface;
+import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.junit.Test;
 
 /**
@@ -39,10 +44,13 @@
         DefaultJavaInterfaceFactory iFactory = new DefaultJavaInterfaceFactory();
         JavaInterface iface = iFactory.createJavaInterface(TestJavaInterface.class);
         new JAXWSJavaInterfaceProcessor().visitInterface(iface);
+        DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint();
+        new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface);
+        WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition();
         Interface2WSDLGenerator generator = new Interface2WSDLGenerator();
-        Definition definition = generator.generate(iface);
-        // System.out.println(definition);
+        Definition definition = generator.generate(iface, wsdlDefinition);
 
+        // print the generated WSDL file and inline schemas
         WSDLWriter writer = generator.getFactory().newWSDLWriter();
         StringWriter sw = new StringWriter();
         writer.writeWSDL(definition, sw);

Modified: incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl-java2wsdl/src/test/java/org/apache/tuscany/sca/interfacedef/wsdl/java2wsdl/Java2WSDLHelperTestCase.java Thu Apr 24 14:20:08 2008
@@ -21,18 +21,26 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.jws.WebService;
 import javax.wsdl.Definition;
 import javax.wsdl.Operation;
 import javax.wsdl.PortType;
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.sca.core.databinding.processor.DataBindingJavaInterfaceProcessor;
+import org.apache.tuscany.sca.databinding.DefaultDataBindingExtensionPoint;
 import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
 import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.jaxws.JAXWSJavaInterfaceProcessor;
+import org.apache.tuscany.sca.interfacedef.wsdl.TestJavaInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
 
+import org.osoa.sca.annotations.Remotable;
+
 public class Java2WSDLHelperTestCase extends TestCase {
 
     public void testCreateDefinition() {
@@ -57,7 +65,11 @@
     public void testCreateWSDLInterfaceContract() throws InvalidInterfaceException {
         DefaultJavaInterfaceFactory factory = new DefaultJavaInterfaceFactory();
         JavaInterfaceContract javaIC = factory.createJavaInterfaceContract();
-        javaIC.setInterface(factory.createJavaInterface(HelloWorld.class));
+        JavaInterface iface = factory.createJavaInterface(HelloWorld.class);
+        new JAXWSJavaInterfaceProcessor().visitInterface(iface);
+        DefaultDataBindingExtensionPoint dataBindings = new DefaultDataBindingExtensionPoint();
+        new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface);
+        javaIC.setInterface(iface);
         WSDLInterfaceContract wsdlIC = Java2WSDLHelper.createWSDLInterfaceContract(javaIC);
         assertNotNull(wsdlIC);
         WSDLInterface wsdlInterface = (WSDLInterface)wsdlIC.getInterface();
@@ -65,10 +77,19 @@
         assertEquals(1, wsdlInterface.getOperations().size());
         assertEquals("sayHello", wsdlInterface.getOperations().get(0).getName());
         assertNotNull(wsdlInterface.getPortType());
+ 
+        JavaInterfaceContract javaIC2 = factory.createJavaInterfaceContract();
+        JavaInterface iface2 = factory.createJavaInterface(TestJavaInterface.class);
+        new JAXWSJavaInterfaceProcessor().visitInterface(iface2);
+        new DataBindingJavaInterfaceProcessor(dataBindings).visitInterface(iface2);
+        javaIC2.setInterface(iface2);
+        WSDLInterfaceContract wsdlIC2 = Java2WSDLHelper.createWSDLInterfaceContract(javaIC2);
+        assertNotNull(wsdlIC2);
     }
 
 }
 
+@Remotable
 interface HelloWorld {
     String sayHello(String s);
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/WSDLDefinition.java Thu Apr 24 14:20:08 2008
@@ -22,6 +22,7 @@
 import java.net.URI;
 import java.util.List;
 
+import javax.wsdl.Binding;
 import javax.wsdl.Definition;
 import javax.wsdl.WSDLElement;
 import javax.xml.namespace.QName;
@@ -106,4 +107,15 @@
      */
     <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name);
 
+    /**
+     * Get the generated binding for a WSDLDefinition
+     * @return the WSDL binding
+     */
+    Binding getBinding();
+
+    /**
+     * Set the generated binding for a WSDLDefinition
+     * @param binding the WSDL binding
+     */
+    void setBinding(Binding binding);
 }

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java (original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLDefinitionImpl.java Thu Apr 24 14:20:08 2008
@@ -55,6 +55,7 @@
     private URI location;
     private List<XSDefinition> schemas = new ArrayList<XSDefinition>();
     private boolean unresolved;
+    private Binding binding;
 
     protected WSDLDefinitionImpl() {
     }
@@ -252,6 +253,14 @@
 
     public <T extends WSDLElement> WSDLObject<T> getWSDLObject(Class<T> type, QName name) {
         return getWSDLObject(definition, type, name);
+    }
+
+    public Binding getBinding() {
+        return binding;
+    }
+
+    public void setBinding(Binding binding) {
+        this.binding = binding;
     }
 
 }

Modified: incubator/tuscany/java/sca/samples/zipcode-jaxws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/zipcode-jaxws/pom.xml?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/zipcode-jaxws/pom.xml (original)
+++ incubator/tuscany/java/sca/samples/zipcode-jaxws/pom.xml Thu Apr 24 14:20:08 2008
@@ -100,6 +100,7 @@
     <build>
         <finalName>${artifactId}</finalName>
         <plugins>
+            <!-- comment out the following to build offline -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-antrun-plugin</artifactId>
@@ -126,6 +127,7 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- end of offline excluded section -->
             <plugin>
                 <groupId>org.apache.tuscany.sca</groupId>
                 <artifactId>tuscany-maven-ant-generator</artifactId>

Modified: incubator/tuscany/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite?rev=651426&r1=651425&r2=651426&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite (original)
+++ incubator/tuscany/java/sca/samples/zipcode-jaxws/src/main/resources/ZipCode.composite Thu Apr 24 14:20:08 2008
@@ -1,33 +1,33 @@
-<?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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
-    targetNamespace="http://zipcode" name="ZipCode">
-
-    <component name="ZipCodeService">
-        <implementation.java class="zipcode.ZipCodeServiceImpl" />
-        <reference name="usZipService">
-            <binding.ws wsdlElement="http://www.webserviceX.NET#wsdl.port(USZip/USZipSoap)" />
-        </reference>
-        <reference name="weatherForecast">
-            <binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)" />
-        </reference>
-    </component>
-
-</composite>
+<?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:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+    targetNamespace="http://zipcode" name="ZipCode">
+
+    <component name="ZipCodeService">
+        <implementation.java class="zipcode.ZipCodeServiceImpl" />
+        <reference name="usZipService">
+            <binding.ws uri="http://www.webservicex.net/uszip.asmx" />
+        </reference>
+        <reference name="weatherForecast">
+            <binding.ws wsdlElement="http://www.webservicex.net#wsdl.port(WeatherForecast/WeatherForecastSoap)" />
+        </reference>
+    </component>
+
+</composite>

Added: incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java?rev=651426&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java (added)
+++ incubator/tuscany/java/sca/samples/zipcode-jaxws/src/test/java/zipcode/ZipCodeClientTestCase.java Thu Apr 24 14:20:08 2008
@@ -0,0 +1,51 @@
+/*
+ * 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 zipcode;
+
+import location.LocationClient;
+import weather.WeatherForecastClient;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests that the callback server is available
+ */
+public class ZipCodeClientTestCase {
+
+    @Before
+	public void startServer() throws Exception {
+	}
+
+	@Test
+	public void testClient() throws Exception {
+        /*
+        System.out.println("Running LocationClient...");
+		LocationClient.main(null);
+        System.out.println("Running WeatherForecastClient...");
+        WeatherForecastClient.main(null);
+        */
+        System.out.println("Running ZipCodeClient...");
+        ZipCodeClient.main(null);
+	}
+    
+	@After
+	public void stopServer() throws Exception {
+	}
+}