cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1364754 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding: source/SourceDataBinding.java stax/StaxDataBinding.java
Date Mon, 23 Jul 2012 19:08:28 GMT
Author: dkulp
Date: Mon Jul 23 19:08:27 2012
New Revision: 1364754

URL: http://svn.apache.org/viewvc?rev=1364754&view=rev
Log:
For source and stax databinding, set the "type" to anyType so java first
case will at least generate a simple but crappy wsdl

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java?rev=1364754&r1=1364753&r2=1364754&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/source/SourceDataBinding.java
Mon Jul 23 19:08:27 2012
@@ -19,14 +19,20 @@
 
 package org.apache.cxf.databinding.source;
 
+
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Node;
 
+import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.ServiceModelVisitor;
+import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 
 /**
  * A simple databinding implementation which reads and writes Source objects.
@@ -40,7 +46,21 @@ public class SourceDataBinding extends o
     }
 
     public void initialize(Service service) {
-        // do nothing
+        for (ServiceInfo serviceInfo : service.getServiceInfos()) {
+            SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
+            if (schemaCollection.getXmlSchemas().length > 1) {
+                // Schemas are already populated.
+                continue;
+            }
+            new ServiceModelVisitor(serviceInfo) {
+                public void begin(MessagePartInfo part) {
+                    if (part.getTypeQName() != null || part.getElementQName() != null) {
+                        return;
+                    }
+                    part.setTypeQName(XmlSchemaConstants.ANY_TYPE_QNAME);
+                }
+            } .walk();
+        }
     }
     
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java?rev=1364754&r1=1364753&r2=1364754&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/databinding/stax/StaxDataBinding.java Mon
Jul 23 19:08:27 2012
@@ -32,13 +32,17 @@ import org.w3c.dom.Node;
 
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.common.xmlschema.XmlSchemaConstants;
 import org.apache.cxf.databinding.AbstractDataBinding;
 import org.apache.cxf.databinding.DataReader;
 import org.apache.cxf.databinding.DataWriter;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Attachment;
 import org.apache.cxf.service.Service;
+import org.apache.cxf.service.ServiceModelVisitor;
 import org.apache.cxf.service.model.MessagePartInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.staxutils.StaxUtils;
 
 /**
@@ -57,9 +61,23 @@ public class StaxDataBinding extends Abs
     }
 
     public void initialize(Service service) {
-        // do nothing
+        for (ServiceInfo serviceInfo : service.getServiceInfos()) {
+            SchemaCollection schemaCollection = serviceInfo.getXmlSchemaCollection();
+            if (schemaCollection.getXmlSchemas().length > 1) {
+                // Schemas are already populated.
+                continue;
+            }
+            new ServiceModelVisitor(serviceInfo) {
+                public void begin(MessagePartInfo part) {
+                    if (part.getTypeQName() != null || part.getElementQName() != null) {
+                        return;
+                    }
+                    part.setTypeQName(XmlSchemaConstants.ANY_TYPE_QNAME);
+                }
+            } .walk();
+        }
     }
-    
+
     @SuppressWarnings("unchecked")
     public <T> DataReader<T> createReader(Class<T> cls) {
         if (cls == XMLStreamReader.class) {



Mime
View raw message