You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2007/12/18 04:55:38 UTC

svn commit: r605074 [1/2] - in /incubator/cxf/trunk: common/common/src/main/java/org/apache/cxf/common/xmlschema/ rt/core/src/main/java/org/apache/cxf/databinding/source/ rt/core/src/main/java/org/apache/cxf/test/ rt/databinding/xmlbeans/ rt/databindin...

Author: dkulp
Date: Mon Dec 17 19:55:35 2007
New Revision: 605074

URL: http://svn.apache.org/viewvc?rev=605074&view=rev
Log:
Bunches of updates for xmlbeans databinding.
Port all the xmlbeans unit tests from xfire.
Get strings working (need to fill in the map in XmlBeansSchemaInitializer for others)

Added:
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/SetWeatherData.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/WeatherServiceRPCLitTest.java   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/sampleRequest.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/soap11fault.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/undeclaredns.xml   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/Base.xsd   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/Request.xsd   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/Response.xsd   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/WeatherForecast.xsd   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/anyschema.xsd   (with props)
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/xsd/idref.xsd   (with props)
Modified:
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/pom.xml
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataReaderImpl.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/AbstractXmlBeansTest.java
    incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/basic/TestService.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/JaxWsServiceFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/xmlschema/SchemaCollection.java Mon Dec 17 19:55:35 2007
@@ -212,6 +212,16 @@
         }
     }
     
+    public void addGlobalElementToSchema(XmlSchemaElement element) {
+        XmlSchema schema = getSchemaByTargetNamespace(element.getQName().getNamespaceURI());
+        if (schema == null) {
+            schema = newXmlSchemaInCollection(element.getQName().getNamespaceURI());
+        }
+        schema.getItems().add(element);
+        // believe it or not, it is up to us to do both of these adds!
+        schema.getElements().add(element.getQName(), element);
+    }
+    
     public static void addGlobalElementToSchema(XmlSchema schema, XmlSchemaElement element) {
         schema.getItems().add(element);
         // believe it or not, it is up to us to do both of these adds!

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java Mon Dec 17 19:55:35 2007
@@ -49,7 +49,7 @@
         this.schemas = schemas;
     }
 
-    protected XmlSchema addSchemaDocument(ServiceInfo serviceInfo, SchemaCollection col, Document d,
+    public XmlSchema addSchemaDocument(ServiceInfo serviceInfo, SchemaCollection col, Document d,
                                           String systemId) {
         String ns = d.getDocumentElement().getAttribute("targetNamespace");
         if (StringUtils.isEmpty(ns)) {

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/AbstractCXFTest.java Mon Dec 17 19:55:35 2007
@@ -103,6 +103,15 @@
     }
 
     /**
+     * Assert that the following XPath query selects a boolean value.
+     * 
+     * @param xpath
+     * @throws Exception 
+     */
+    public boolean assertValidBoolean(String xpath, Node node) throws Exception {
+        return testUtilities.assertValidBoolean(xpath, node);
+    }
+    /**
      * Assert that the following XPath query selects no nodes.
      * 
      * @param xpath

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/TestUtilities.java Mon Dec 17 19:55:35 2007
@@ -121,6 +121,17 @@
     public NodeList assertValid(String xpath, Node node) throws Exception {
         return XPathAssert.assertValid(xpath, node, namespaces);
     }
+    
+    /**
+     * Assert that the following XPath query selects a boolean value.
+     * 
+     * @param xpath
+     * @throws Exception
+     */
+    public boolean assertValidBoolean(String xpath, Node node) throws Exception {
+        return XPathAssert.assertValidBoolean(xpath, node, namespaces);
+    }
+
 
     /**
      * Assert that the following XPath query selects no nodes.
@@ -193,7 +204,7 @@
         try {
             return DOMUtils.readXml(input);
         } catch (SAXParseException e) {
-            throw new IllegalStateException("Could not parse message:\n" + new String(bs));
+            throw new IllegalStateException("Could not parse message:\n" + new String(bs), e);
         }
     }
 

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/test/XPathAssert.java Mon Dec 17 19:55:35 2007
@@ -67,6 +67,26 @@
 
         return nodes;
     }
+    /**
+     * Assert that the following XPath query selects one or more nodes.
+     * 
+     * @param xpath
+     */
+    public static boolean assertValidBoolean(String xpath, Node node, Map<String, String> namespaces)
+        throws Exception {
+        if (node == null) {
+            throw new NullPointerException("Node cannot be null.");
+        }
+
+        Boolean b = (Boolean)createXPath(namespaces).evaluate(xpath, node, XPathConstants.BOOLEAN);
+
+        if (b == null) {
+            throw new AssertionFailedError("Failed to select any nodes for expression:\n" + xpath
+                                           + " from document:\n" + writeNodeToString(node));
+        }
+
+        return b.booleanValue();
+    }
 
     private static String writeNodeToString(Node node) {
         ByteArrayOutputStream bos = new ByteArrayOutputStream();

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/pom.xml?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/pom.xml (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/pom.xml Mon Dec 17 19:55:35 2007
@@ -55,7 +55,6 @@
             <artifactId>cxf-rt-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-tools-common</artifactId>

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataReaderImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataReaderImpl.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataReaderImpl.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataReaderImpl.java Mon Dec 17 19:55:35 2007
@@ -24,6 +24,7 @@
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.validation.Schema;
 
@@ -33,6 +34,9 @@
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 
 
@@ -47,20 +51,66 @@
     }
 
     public Object read(MessagePartInfo part, XMLStreamReader reader) {
-        Class<?> cls[] = part.getTypeClass().getDeclaredClasses();
+        Class<?> typeClass = part.getTypeClass();
+        boolean unwrap = false;
+        if (!XmlObject.class.isAssignableFrom(typeClass)) {
+            typeClass = (Class<?>)part.getProperty(XmlAnySimpleType.class.getName());
+            unwrap = true;
+        }
+        boolean isOutClass = false;
+        Class<?> encClass = typeClass.getEnclosingClass();
+        if (encClass != null) {
+            typeClass = encClass;
+            isOutClass = true;
+        }
+        Class<?> cls[] = typeClass.getDeclaredClasses();
+        Object obj = null;
         for (Class<?> c : cls) {
             if ("Factory".equals(c.getSimpleName())) {
                 try {
+                    SchemaType st = (SchemaType)part.getProperty(SchemaType.class.getName());
                     XmlOptions options = new XmlOptions();
-                    options.setLoadReplaceDocumentElement(null);
+                    if (!st.isDocumentType() && !isOutClass) {
+                        options.setLoadReplaceDocumentElement(null);
+                    }
                     Method meth = c.getMethod("parse", XMLStreamReader.class, XmlOptions.class);
-                    return meth.invoke(null, reader, options);
+                    obj = meth.invoke(null, reader, options);
+                    break;
                 } catch (Exception e) {
+                    e.printStackTrace();
                     throw new Fault(new Message("UNMARSHAL_ERROR", LOG, part.getTypeClass()), e);
                 }
             }
         }
-        return null;
+        if (unwrap && obj != null) {
+            try {
+                Method m = obj.getClass().getMethod("get" + part.getTypeClass().getSimpleName() + "Value");
+                obj = m.invoke(obj);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        } else if (isOutClass) {
+            for (Method m : encClass.getDeclaredMethods()) {
+                if (m.getName().startsWith("get")
+                    && m.getParameterTypes().length == 0
+                    && m.getReturnType().equals(part.getTypeClass())) {
+                    try {
+                        obj = m.invoke(obj);
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
+        if (reader.getEventType() == XMLStreamReader.END_ELEMENT) {
+            try {
+                reader.next();
+            } catch (XMLStreamException e) {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+        }
+        return obj;
     }
 
     public Object read(QName name, XMLStreamReader input, Class type) {

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/DataWriterImpl.java Mon Dec 17 19:55:35 2007
@@ -20,6 +20,7 @@
 package org.apache.cxf.xmlbeans;
 
 
+import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.logging.Logger;
 
@@ -30,14 +31,19 @@
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.model.MessagePartInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.xmlbeans.SchemaType;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
 import org.apache.xmlbeans.XmlOptions;
 import org.apache.xmlbeans.XmlTokenSource;
+import org.apache.xmlbeans.impl.values.XmlObjectBase;
 
 public class DataWriterImpl implements DataWriter<XMLStreamWriter> {
     private static final Logger LOG = LogUtils.getLogger(XmlBeansDataBinding.class);
@@ -51,15 +57,66 @@
     
     public void write(Object obj, MessagePartInfo part, XMLStreamWriter output) {
         try {
+            Class<?> typeClass = part.getTypeClass();
+            if (!XmlObject.class.isAssignableFrom(typeClass)) {
+                typeClass = (Class<?>)part.getProperty(XmlAnySimpleType.class.getName());
+                
+                Class<?> cls[] = typeClass.getDeclaredClasses();
+                for (Class<?> c : cls) {
+                    if ("Factory".equals(c.getSimpleName())) {
+                        try {
+                            SchemaType st = (SchemaType)part.getProperty(SchemaType.class.getName());
+                            XmlOptions options = new XmlOptions();
+                            if (!st.isDocumentType()) {
+                                options.setLoadReplaceDocumentElement(null);
+                            }
+                            Method meth = c.getMethod("newValue", Object.class);
+                            obj = meth.invoke(null, obj);
+                            break;
+                        } catch (Exception e) {
+                            throw new Fault(new Message("UNMARSHAL_ERROR", LOG, part.getTypeClass()), e);
+                        }
+                    }
+                }
+            }
+
+            
             if (obj != null
                 || !(part.getXmlSchema() instanceof XmlSchemaElement)) {
-                XmlTokenSource source = (XmlTokenSource)obj;
                 XmlOptions options = new XmlOptions();
-                XMLStreamReader reader = source.newCursor().newXMLStreamReader(options);
-                output.writeStartElement(part.getConcreteName().getNamespaceURI(),
-                                         part.getConcreteName().getLocalPart());
-                StaxUtils.copy(reader, output, true);
-                output.writeEndElement();
+                XMLStreamReader reader;
+                if (obj instanceof XmlObjectBase) {
+                    XmlObjectBase source = (XmlObjectBase)obj;
+                    reader = source.newCursorForce().newXMLStreamReader(options);
+                } else {
+                    XmlTokenSource source = (XmlTokenSource)obj;
+                    reader = source.newCursor().newXMLStreamReader(options);                    
+                }
+                SchemaType st = (SchemaType)part.getProperty(SchemaType.class.getName());
+
+                if (!st.isDocumentType()) {
+                    if (StringUtils.isEmpty(part.getConcreteName().getNamespaceURI())) {
+                        output.writeStartElement(part.getConcreteName().getNamespaceURI(),
+                                                 part.getConcreteName().getLocalPart());
+                        
+                    } else {
+                        String pfx = output.getPrefix(part.getConcreteName().getNamespaceURI());
+                        if (StringUtils.isEmpty(pfx)) {
+                            output.writeStartElement("tns",
+                                             part.getConcreteName().getLocalPart(),
+                                             part.getConcreteName().getNamespaceURI());
+                            output.writeNamespace("tns", part.getConcreteName().getNamespaceURI());
+                        } else {
+                            output.writeStartElement(pfx,
+                                                     part.getConcreteName().getLocalPart(),
+                                                     part.getConcreteName().getNamespaceURI());
+                        }
+                    }
+                    StaxUtils.copy(reader, output, true);
+                    output.writeEndElement();
+                } else {
+                    StaxUtils.copy(reader, output, true);
+                }
             } else if (obj == null && needToRender(obj, part)) {
                 output.writeStartElement(part.getConcreteName().getNamespaceURI(),
                                          part.getConcreteName().getLocalPart());

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.xmlbeans;
+
+
+import java.util.Collection;
+import javax.xml.validation.Schema;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.databinding.DataWriter;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.staxutils.W3CDOMStreamWriter;
+
+public class NodeDataWriterImpl implements DataWriter<Node> {
+    DataWriterImpl writer;
+    
+    public NodeDataWriterImpl() {
+        writer = new DataWriterImpl();
+    }
+    
+    public void write(Object obj, Node output) {
+        write(obj, null, output);
+    }
+    
+    public void write(Object obj, MessagePartInfo part, Node output) {
+        W3CDOMStreamWriter domWriter = new W3CDOMStreamWriter((Element)output);
+        writer.write(obj, part, domWriter);
+    }
+
+    public void setAttachments(Collection<Attachment> attachments) {
+        writer.setAttachments(attachments);
+    }
+
+    public void setProperty(String key, Object value) {
+        writer.setProperty(key, value);
+    }
+
+    public void setSchema(Schema s) {
+        writer.setSchema(s);
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/NodeDataWriterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansDataBinding.java Mon Dec 17 19:55:35 2007
@@ -26,7 +26,8 @@
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
@@ -36,7 +37,6 @@
 import org.apache.cxf.databinding.source.AbstractDataBinding;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.ServiceInfo;
-import org.apache.ws.commons.schema.XmlSchema;
 
 
 /**
@@ -46,13 +46,16 @@
     private static final Logger LOG = LogUtils.getLogger(XmlBeansDataBinding.class);
 
     private static final Class<?> SUPPORTED_READER_FORMATS[] = new Class<?>[] {XMLStreamReader.class};
-    private static final Class<?> SUPPORTED_WRITER_FORMATS[] = new Class<?>[] {XMLStreamWriter.class};
+    private static final Class<?> SUPPORTED_WRITER_FORMATS[]
+        = new Class<?>[] {XMLStreamWriter.class, Node.class};
     
     
     @SuppressWarnings("unchecked")
     public <T> DataWriter<T> createWriter(Class<T> c) {
         if (c == XMLStreamWriter.class) {
             return (DataWriter<T>)new DataWriterImpl();
+        } else if (c == Node.class) {
+            return (DataWriter<T>)new NodeDataWriterImpl();
         }
         return null;
     }
@@ -100,11 +103,5 @@
             schemaInit.walk();
         }
     }
-    
-    public XmlSchema addSchemaDocument(ServiceInfo serviceInfo, 
-                                        SchemaCollection col,
-                                        Document d,
-                                        String systemId) {
-        return super.addSchemaDocument(serviceInfo, col, d, systemId);
-    }
+
 }

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java Mon Dec 17 19:55:35 2007
@@ -29,9 +29,13 @@
 import javax.xml.namespace.QName;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.service.ServiceModelVisitor;
@@ -42,17 +46,27 @@
 import org.apache.ws.commons.schema.XmlSchemaType;
 import org.apache.xmlbeans.SchemaType;
 import org.apache.xmlbeans.SchemaTypeSystem;
+import org.apache.xmlbeans.XmlAnySimpleType;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlString;
+import org.apache.xmlbeans.impl.schema.BuiltinSchemaTypeSystem;
 
 /**
  * Walks the service model and sets up the element/type names.
  */
 class XmlBeansSchemaInitializer extends ServiceModelVisitor {
     private static final Logger LOG = LogUtils.getLogger(XmlBeansSchemaInitializer.class);
+    private static final Map<Class<?>, Class<? extends XmlAnySimpleType>> CLASS_MAP 
+        = new HashMap<Class<?>, Class<? extends XmlAnySimpleType>>();
     private SchemaCollection schemas;
     private XmlBeansDataBinding dataBinding;
     private Map<String, XmlSchema> schemaMap 
         = new HashMap<String, XmlSchema>();
     
+    static {
+        CLASS_MAP.put(String.class, XmlString.class);
+    }
+    
     public XmlBeansSchemaInitializer(ServiceInfo serviceInfo,
                                      SchemaCollection col,
                                      XmlBeansDataBinding db) {
@@ -68,7 +82,25 @@
         }
         InputStream ins = sts.getSourceAsStream(file);
         try {
+            //temporary marker to make sure recursive imports don't blow up
+            schemaMap.put(file, null);
+
             Document doc = XMLUtils.parse(ins);
+            
+            NodeList nodes = doc.getDocumentElement().getChildNodes();
+            for (int i = 0; i < nodes.getLength(); i++) {
+                Node n = nodes.item(i);
+                if (n instanceof Element) {
+                    Element e = (Element)n;
+                    if (e.getLocalName().equals("import")) {
+                        String loc = e.getAttribute("schemaLocation");
+                        if (!StringUtils.isEmpty(loc)) {
+                            getSchema(sts, loc);
+                        }
+                    }
+                }
+            }            
+            
             XmlSchema schema = dataBinding.addSchemaDocument(serviceInfo,
                                                              schemas, 
                                                              doc, 
@@ -98,14 +130,37 @@
         if (isFromWrapper && clazz.isArray() && !Byte.TYPE.equals(clazz.getComponentType())) {
             clazz = clazz.getComponentType();
         }
+        mapClass(part, clazz);
+    }
+    private void mapClass(MessagePartInfo part, Class clazz) {
+        if (!XmlObject.class.isAssignableFrom(clazz)) {
+            
+            Class<? extends XmlAnySimpleType> type = CLASS_MAP.get(clazz);
+            SchemaTypeSystem sts = BuiltinSchemaTypeSystem.get();
+            SchemaType st2 = sts.typeForClassname(type.getName());
+
+            part.setProperty(SchemaType.class.getName(), st2);
+            part.setProperty(XmlAnySimpleType.class.getName(), type);
+            part.setTypeQName(st2.getName());
+            XmlSchemaType xmlSchema = schemas.getTypeByQName(st2.getName());
+            part.setXmlSchema(xmlSchema);
+            return;
+        }
         try {
             Field field = clazz.getField("type");
             SchemaType st = (SchemaType)field.get(null);
+            part.setProperty(SchemaType.class.getName(), st);
             
             SchemaTypeSystem sts = st.getTypeSystem();
             XmlSchema schema = getSchema(sts, st.getSourceName());
 
-            if (st.getComponentType() == SchemaType.ELEMENT) {
+            if (st.isDocumentType()) {
+                XmlSchemaElement sct = schema.getElementByName(st.getDocumentElementName());
+                part.setXmlSchema(sct);
+                part.setElement(true);
+                part.setElementQName(st.getDocumentElementName());
+                part.setConcreteName(st.getDocumentElementName());
+            } else if (st.getComponentType() == SchemaType.ELEMENT) {
                 XmlSchemaElement sct = schema.getElementByName(st.getName());
                 part.setXmlSchema(sct);
                 part.setElement(true);
@@ -134,8 +189,7 @@
                 if (isFromWrapper && clazz.isArray() && !Byte.TYPE.equals(clazz.getComponentType())) {
                     clazz = clazz.getComponentType();
                 }
-                
-                //FIXME - find and set the part.setXmlSchema(....) info
+                mapClass(part, clazz);
             }
         }
     }

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/AbstractXmlBeansTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/AbstractXmlBeansTest.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/AbstractXmlBeansTest.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/AbstractXmlBeansTest.java Mon Dec 17 19:55:35 2007
@@ -44,6 +44,7 @@
 import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory;
 import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.test.AbstractCXFTest;
 import org.apache.cxf.transport.ConduitInitiatorManager;
@@ -141,13 +142,14 @@
                                                      String address, 
                                                      QName name,
                                                      XmlBeansDataBinding binding) {
-        ServerFactoryBean sf = new ServerFactoryBean();
+        JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
         sf.setServiceClass(serviceClass);
         if (serviceBean != null) {
             sf.setServiceBean(serviceBean);
         }    
         sf.getServiceFactory().setServiceName(name);
         sf.setAddress("local://" + address);
+        sf.getServiceFactory().setQualifyWrapperSchema(true);
         setupXmlBeans(sf, binding);
         return sf;
     }
@@ -182,6 +184,15 @@
         for (Server s : svrMan.getServers()) {
             Service svc = s.getEndpoint().getService();
             if (svc.getName().getLocalPart().equals(string)) {
+                ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, svc.getServiceInfos());
+                return builder.build();
+            }
+        }
+        String localString = "local://" + string;
+        for (Server s : svrMan.getServers()) {
+            String s2 = s.getDestination().getAddress().getAddress().getValue();
+            if (localString.equals(s2)) {
+                Service svc = s.getEndpoint().getService();
                 ServiceWSDLBuilder builder = new ServiceWSDLBuilder(bus, svc.getServiceInfos());
                 return builder.build();
             }

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,5 @@
+<mappings xmlns:ex="http://cxf.apache.org/xmlbeans/exception">
+  <mapping name="ex:CustomFault">
+    <property name="extraInfo" style="attribute" />
+  </mapping>
+</mappings>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.aegis.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.xml.ws.WebFault;
+
+@WebFault
+public class CustomFault extends Exception {
+    private String extraInfo;
+
+    public CustomFault() {
+        super("custom fault");
+    }
+
+    public String getFaultInfo() {
+        return extraInfo;
+    }
+
+    public void setFaultInfo(String e) {
+        this.extraInfo = e;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/CustomFault.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,11 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Header/>
+ <env:Body xmlns="urn:TestService">
+ 	<mixedRequest>
+	    <string>foo</string>
+	    <request xmlns="http://cxf.apache.org/xmlbeans">
+	      <sessionId>foo</sessionId>
+	    </request>
+    </mixedRequest>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.util.SOAPConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class DocumentStyleTest extends AbstractXmlBeansTest {
+    String ns = "urn:TestService";
+    
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        createService(TestService.class, new TestService(), "TestService", new QName(ns, "TestService"));
+    }
+
+    @Test
+    public void testInvoke() throws Exception {
+        Node response = invoke("TestService", "/org/apache/cxf/xmlbeans/DocumentStyleRequest.xml");
+
+        assertNotNull(response);
+
+        addNamespace("x", "http://cxf.apache.org/xmlbeans");
+        addNamespace("y", "urn:TestService");
+        assertValid("//s:Body/y:mixedRequestResponse/x:response/x:form", response);
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Document wsdl = getWSDLDocument("TestService");
+
+        addNamespace("xsd", SOAPConstants.XSD);
+        assertValid("//xsd:schema[@targetNamespace='urn:TestService']"
+                    + "/xsd:complexType[@name='mixedRequest']"
+                    + "/xsd:sequence/xsd:element[@name='string'][@type='xsd:string']",
+                    wsdl);
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/DocumentStyleTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,6 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Header/>
+ <env:Body xmlns="urn:TestService">
+	<ThrowFault/>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/FaultRequest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,3 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Body xmlns="http://www.webservicex.net"/>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetForecasts.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,8 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Header/>
+ <env:Body xmlns="http://www.webservicex.net">
+	<GetWeatherByZipCode>
+      <ZipCode>49506</ZipCode>
+	</GetWeatherByZipCode>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/GetWeatherByZip.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,8 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Header/>
+ <env:Body xmlns="urn:xfire:idref">
+	<getSampleElement>
+      
+	</getSampleElement>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefRequest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import com.alservices.xsd.sample.SampleElementDocument;
+
+public class IDRefService {
+
+    /**
+     * This method "gets" a sample Document.
+     * 
+     * @param inSampleElementDocument
+     */
+    public void getSampleMethod(SampleElementDocument inSampleElementDocument) {
+
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import org.w3c.dom.Node;
+import org.junit.Before;
+import org.junit.Test;
+
+
+
+/**
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class IDRefServiceTest extends AbstractXmlBeansTest {
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        createService(IDRefService.class, new IDRefService(), "IDRefService", null);
+    }
+
+    @Test
+    public void testInvoke() throws Exception {
+        Node response = getWSDLDocument("IDRefService");
+        assertNotNull(response);
+
+        /*
+         * 
+         *  SampleElementDocument doc =
+         * SampleElementDocument.Factory.newInstance(); SampleElement
+         * sampleElement = doc.addNewSampleElement(); SampleUserInformation
+         * information = sampleElement.addNewSampleUserInformation();
+         * addNamespace("t", "urn:TestService"); addNamespace("x",
+         * "http://cxf.apache.org/xmlbeans");
+         * assertValid("//t:mixedRequestResponse/x:response/x:form", response);
+         */
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/IDRefServiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.cxf.common.util.SOAPConstants;
+import org.junit.Before;
+import org.junit.Test;
+  
+/**
+ * Tests that we can handle multiple schemas within the same namespace.
+ * 
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class MultipleSchemaInNSTest extends AbstractXmlBeansTest {
+    String ns = "urn:xfire:xmlbeans:nstest";
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        createService(MultipleSchemaService.class,
+                      new MultipleSchemaService(),
+                      "MultipleSchemaService", 
+                      new QName("http://xmlbeans.cxf.apache.org/", "MultipleSchemaService"));
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Node wsdl = getWSDLDocument("MultipleSchemaService");
+
+        addNamespace("xsd", SOAPConstants.XSD);
+        NodeList list = assertValid("//xsd:schema[@targetNamespace='" + ns + "']", wsdl);
+        assertEquals(3, list.getLength());
+        assertValid("//xsd:import[@namespace='" + ns + "']",
+                    list.item(0));
+        assertValid("//xsd:import[@namespace='" + ns + "']", list.item(0));
+        
+        assertValid("//xsd:import[@namespace='" + ns + "']",
+                      list.item(1));
+        assertValid("//xsd:import[@namespace='" + ns + "']",
+                    list.item(2));
+        assertInvalid("//xsd:import[@namespace='" + ns + "']/@schemaLocation",
+                    list.item(1));
+        assertInvalid("//xsd:import[@namespace='" + ns + "']/@schemaLocation",
+                    list.item(2));
+        /*
+        endpoint.setProperty(AbstractWSDL.REMOVE_ALL_IMPORTS, "True");
+
+        wsdl = getWSDLDocument("MultipleSchemaService");
+
+        assertValid("//xsd:schema[@targetNamespace='" + ns + "'][1]", wsdl);
+        assertInvalid("//xsd:schema[@targetNamespace='" + ns + "'][1]" + "/xsd:import[@namespace='" + ns
+                      + "']", wsdl);
+        assertValid("//xsd:schema[@targetNamespace='" + ns + "'][3]", wsdl);
+        assertInvalid("//xsd:schema[@targetNamespace='" + ns + "'][3]" + "/xsd:import[@namespace='" + ns
+                      + "']", wsdl);
+                      */
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaInNSTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.jws.WebMethod;
+import javax.jws.soap.SOAPBinding;
+
+import xfireXmlbeansNstest.RequestTextDocument;
+import xfireXmlbeansNstest.ResponseTextDocument;
+
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public class MultipleSchemaService {
+    @WebMethod
+    public ResponseTextDocument testOne(RequestTextDocument requestTextDocument) {
+        return null;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/MultipleSchemaService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+import junit.framework.Assert;
+
+@WebService(targetNamespace = "urn:TestService", 
+            serviceName = "TestService")
+public class TestService {
+    @WebMethod(operationName = "GetWeatherByZipCode")
+    public ResponseDocument getWeatherByZipCode(RequestDocument body) {
+        return ResponseDocument.Factory.newInstance();
+    }
+
+    @WebMethod(operationName = "GetTrouble")
+    public TroubleDocument getTrouble(TroubleDocument trouble) {
+        return trouble;
+    }
+
+    @WebMethod(operationName = "ThrowFault")
+    public TroubleDocument throwFault() throws CustomFault {
+        CustomFault fault = new CustomFault();
+        fault.setFaultInfo("extra");
+        throw fault;
+    }
+
+    @WebMethod
+    public ResponseDocument mixedRequest(
+                                         @WebParam(name = "string") String string,
+                                         @WebParam(name = "request") RequestDocument req) {
+        Assert.assertEquals("foo", string);
+        Assert.assertEquals("foo", req.getRequest().getSessionId());
+
+        ResponseDocument response = ResponseDocument.Factory.newInstance();
+        response.addNewResponse().addNewForm();
+        return response;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/TestService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java Mon Dec 17 19:55:35 2007
@@ -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.cxf.xmlbeans;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import net.webservicex.GetWeatherByZipCodeDocument;
+import net.webservicex.GetWeatherByZipCodeResponseDocument;
+import net.webservicex.WeatherForecasts;
+
+/**
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+@WebService(targetNamespace = "http://www.webservicex.net")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public class WeatherService {
+    @WebMethod(operationName = "GetWeatherByZipCode")
+    public GetWeatherByZipCodeResponseDocument getWeatherByZipCode(
+        @WebParam(name = "GetWeatherByZipCode") GetWeatherByZipCodeDocument body) {
+        
+        GetWeatherByZipCodeResponseDocument res = GetWeatherByZipCodeResponseDocument.Factory.newInstance();
+
+        WeatherForecasts weather = res.addNewGetWeatherByZipCodeResponse().addNewGetWeatherByZipCodeResult();
+
+        weather.setLatitude(1);
+        weather.setLongitude(1);
+        weather.setPlaceName("Grand Rapids, MI");
+
+        return res;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+import net.webservicex.GetWeatherByZipCodeDocument;
+import net.webservicex.GetWeatherByZipCodeResponseDocument;
+import net.webservicex.WeatherForecasts;
+
+@WebService(targetNamespace = "http://www.webservicex.net")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public class WeatherService2 {
+    
+    @WebMethod(operationName = "GetWeatherByZipCode")
+    public GetWeatherByZipCodeResponseDocument.GetWeatherByZipCodeResponse 
+    getWeatherByZipCode(GetWeatherByZipCodeDocument.GetWeatherByZipCode body) {
+        
+        GetWeatherByZipCodeResponseDocument.GetWeatherByZipCodeResponse res 
+            = GetWeatherByZipCodeResponseDocument.GetWeatherByZipCodeResponse.Factory
+            .newInstance();
+
+        WeatherForecasts weather = res.addNewGetWeatherByZipCodeResult();
+
+        weather.setLatitude(1);
+        weather.setLongitude(1);
+        weather.setPlaceName("Grand Rapids, MI");
+
+        return res;
+    }
+    @WebMethod(operationName = "GetForecasts")
+    public WeatherForecasts getForecasts() {
+        WeatherForecasts weather = WeatherForecasts.Factory.newInstance();
+
+        weather.setLatitude(1);
+        weather.setLongitude(1);
+        weather.setPlaceName("Grand Rapids, MI");
+
+        return weather;
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,65 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.util.SOAPConstants;
+import org.apache.cxf.wsdl.WSDLConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+public class WeatherService2Test extends AbstractXmlBeansTest {
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        createService(WeatherService2.class,
+                      new WeatherService2(),
+                      "WeatherService", null);
+    }
+
+    @Test
+    public void testInvoke() throws Exception {
+        Node response = invoke("WeatherService", "GetWeatherByZip.xml");
+
+        addNamespace("w", "http://www.webservicex.net");
+        assertValid("//w:GetWeatherByZipCodeResponse", response);
+
+        response = invoke("WeatherService", "GetForecasts.xml");
+
+        addNamespace("u", "http://www.webservicex.net");
+        assertValid("//u:GetForecastsResponse", response);
+        assertValid("//u:GetForecastsResponse/w:Latitude", response);
+        assertValid("//u:GetForecastsResponse/w:Longitude", response);
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Node wsdl = getWSDLDocument("WeatherService");
+
+        addNamespace("xsd", SOAPConstants.XSD);
+        addNamespace("w", WSDLConstants.NS_WSDL11);
+
+        assertValid("//w:message[@name='GetForecastsResponse']/w:part[@element='tns:GetForecastsResponse']",
+                    wsdl);
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WeatherService2Test.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,11 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Header/>
+ <env:Body xmlns="urn:TestService">
+	<mixedRequest>
+      <string>foo</string>
+      <request xmlns="http://cxf.apache.org/xmlbeans">
+        <sessionId>foo</sessionId>
+      </request>
+	</mixedRequest>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedRequest.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,97 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.util.SOAPConstants;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.OperationInfo;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class WrappedStyleTest extends AbstractXmlBeansTest {
+    private Server endpoint;
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        endpoint = createService(TestService.class, new TestService(),
+                                 "TestService", new QName("urn:TestService", "TestService"));
+
+    }
+
+    @Test
+    public void testParams() throws Exception {
+        String ns = "urn:TestService";
+        
+        OperationInfo op = endpoint.getEndpoint().getService()
+            .getServiceInfos().get(0).getInterface().getOperation(new QName(ns, "GetWeatherByZipCode"));
+        
+        assertNotNull(op);
+        MessagePartInfo info = op.getUnwrappedOperation().getInput().getMessagePart(0);
+
+        assertEquals(new QName("http://cxf.apache.org/xmlbeans", "request"), info.getElementQName());
+    }
+
+    @Test
+    public void testInvoke() throws Exception {
+        Node response = invoke("TestService", "/org/apache/cxf/xmlbeans/WrappedRequest.xml");
+
+        assertNotNull(response);
+
+        addNamespace("t", "urn:TestService");
+        addNamespace("x", "http://cxf.apache.org/xmlbeans");
+        assertValid("//t:mixedRequestResponse/x:response/x:form", response);
+    }
+
+    @Test
+    public void testFault() throws Exception {
+        Node response = invoke("TestService", "/org/apache/cxf/xmlbeans/FaultRequest.xml");
+
+        assertNotNull(response);
+
+        addNamespace("t", "urn:TestService");
+        addNamespace("x", "http://cxf.apache.org/xmlbeans/exception");
+        assertValid("//detail/t:CustomFault[text()='extra']", response);
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Node wsdl = getWSDLDocument("TestService");
+
+        addNamespace("xsd", SOAPConstants.XSD);
+        assertValid("//xsd:schema[@targetNamespace='urn:TestService']" 
+                    + "/xsd:complexType[@name='mixedRequest']"
+                    + "//xsd:element[@name='string'][@type='xsd:string']", wsdl);
+        assertValid("//xsd:schema[@targetNamespace='urn:TestService']" 
+                    + "/xsd:complexType[@name='mixedRequest']"
+                    + "//xsd:element[@ref='ns0:request']", wsdl);
+        assertValid("//xsd:schema[@targetNamespace='urn:TestService']"
+                    + "/xsd:element[@name='CustomFault'][@type='xsd:string']", wsdl);
+
+    }
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/WrappedStyleTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java Mon Dec 17 19:55:35 2007
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.xmlbeans;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Node;
+
+import org.apache.cxf.common.util.SOAPConstants;
+import org.apache.cxf.wsdl.WSDLConstants;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
+ */
+public class XMLBeansServiceTest extends AbstractXmlBeansTest {
+
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+
+        createService(WeatherService.class, new WeatherService(), 
+                     "WeatherService", new QName("http://www.webservicex.net", "WeatherService"));
+        createService(TestService.class, new TestService(), "TestService",
+                      new QName("urn:TestService", "TestService"));
+    }
+
+    @Test
+    public void testAnyService() throws Exception {
+        try {
+            getWSDLDocument("TestService");
+            assertTrue("Generating WSDL above should not throw an NPE", true);
+        } catch (NullPointerException e) {
+            fail("Shouldn't be throwing an NPE here");
+        }
+    }
+
+    @Test
+    public void testService() throws Exception {
+        Node response = invoke("WeatherService", "GetWeatherByZip.xml");
+
+        addNamespace("w", "http://www.webservicex.net");
+        assertValid("//w:GetWeatherByZipCodeResponse", response);
+    }
+
+    @Test
+    public void testWSDL() throws Exception {
+        Node wsdl = getWSDLDocument("WeatherService");
+        // printNode(wsdl);
+        addNamespace("wsdl", WSDLConstants.NS_WSDL11);
+        addNamespace("wsdlsoap", WSDLConstants.NS_SOAP11);
+        addNamespace("xsd", SOAPConstants.XSD);
+
+        assertValid("//wsdl:types/xsd:schema[@targetNamespace='http://www.webservicex.net']", wsdl);
+        assertValid("//xsd:schema[@targetNamespace='http://www.webservicex.net']"
+                    + "/xsd:element[@name='WeatherForecasts']", wsdl);
+        assertValidBoolean("count(//xsd:schema[@targetNamespace='http://www.webservicex.net']"
+                    + "/xsd:element[@name='WeatherForecasts'])=1", wsdl);
+        assertValid("//xsd:schema[@targetNamespace='http://www.webservicex.net']"
+                    + "/xsd:complexType[@name='WeatherForecasts']", wsdl);
+    }
+
+    @Test
+    public void testAnyWSDL() throws Exception {
+
+        Node wsdl = getWSDLDocument("TestService");
+
+        addNamespace("wsdl", WSDLConstants.NS_WSDL11);
+        addNamespace("wsdlsoap", WSDLConstants.NS_SOAP11);
+        addNamespace("xsd", SOAPConstants.XSD);
+
+        assertValid("//wsdl:types/xsd:schema[@targetNamespace='http://cxf.apache.org/xmlbeans']"
+                    + "/xsd:element[@name='request']", wsdl);
+    }
+
+    @Test
+    public void testAnyWSDLNoDupRootRefElements() throws Exception {
+        Node wsdl = getWSDLDocument("TestService");
+
+        String xpathString = "/wsdl:definitions/wsdl:types//xsd:schema/xsd:element[@name='trouble']";
+
+        addNamespace("wsdl", WSDLConstants.NS_WSDL11);
+        addNamespace("wsdlsoap", WSDLConstants.NS_SOAP11);
+        addNamespace("xsd", SOAPConstants.XSD);
+        addNamespace("s", SOAPConstants.XSD);
+
+        assertEquals(1, assertValid(xpathString, wsdl).getLength());
+    }
+
+
+
+}

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/XMLBeansServiceTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/basic/TestService.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/basic/TestService.java?rev=605074&r1=605073&r2=605074&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/basic/TestService.java (original)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/basic/TestService.java Mon Dec 17 19:55:35 2007
@@ -19,6 +19,10 @@
 
 package org.apache.cxf.xmlbeans.basic;
 
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+
 import org.apache.cxf.databinding.xmlbeans.test.Address;
 
 
@@ -26,8 +30,9 @@
  * 
  */
 public class TestService {
-    
-    public Address echoAddress(Address ad) {
+    @WebMethod
+    @WebResult(name = "return")
+    public Address echoAddress(@WebParam(name = "ad")Address ad) {
         
         Address ret = Address.Factory.newInstance();
         ret.setAddressLine1(ad.getAddressLine1());

Added: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml?rev=605074&view=auto
==============================================================================
--- incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml (added)
+++ incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml Mon Dec 17 19:55:35 2007
@@ -0,0 +1,5 @@
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
+ <env:Body xmlns:x="http://www.webservicex.net">
+   <x:getWeatherData/>
+ </env:Body>
+</env:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/databinding/xmlbeans/src/test/java/org/apache/cxf/xmlbeans/rpc/GetWeatherData.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml