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/10/17 16:22:09 UTC

svn commit: r585517 - in /incubator/cxf/branches/2.0.x-fixes: ./ api/src/main/java/org/apache/cxf/service/model/ common/common/src/main/java/org/apache/cxf/common/util/ parent/ rt/core/src/main/java/org/apache/cxf/databinding/source/ rt/core/src/main/j...

Author: dkulp
Date: Wed Oct 17 07:22:06 2007
New Revision: 585517

URL: http://svn.apache.org/viewvc?rev=585517&view=rev
Log:
Merged revisions 585329 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/cxf/trunk

........
  r585329 | dkulp | 2007-10-16 22:16:38 -0400 (Tue, 16 Oct 2007) | 2 lines
  
  Fix for schemas not getting the mime extensors
........

Added:
    incubator/cxf/branches/2.0.x-fixes/common/common/src/main/java/org/apache/cxf/common/util/FixedExtensionDeserializer.java
      - copied unchanged from r585329, incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/util/FixedExtensionDeserializer.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidgetWithMime.java
      - copied unchanged from r585329, incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxb/model/ExtendedWidgetWithMime.java
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
    incubator/cxf/branches/2.0.x-fixes/parent/pom.xml
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
    incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
    incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java

Propchange: incubator/cxf/branches/2.0.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/api/src/main/java/org/apache/cxf/service/model/SchemaInfo.java Wed Oct 17 07:22:06 2007
@@ -21,8 +21,12 @@
 
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+import org.apache.cxf.helpers.XMLUtils;
+import org.apache.cxf.io.CachedOutputStream;
+import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.ws.commons.schema.XmlSchema;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 
@@ -68,6 +72,31 @@
     }
 
     public Element getElement() {
+        if (element == null && getSchema() != null) {
+            CachedOutputStream cout = new CachedOutputStream();
+            getSchema().write(cout);
+            Document sdoc = null;
+            try {
+                sdoc = XMLUtils.parse(cout.getInputStream());
+                cout.close();
+            } catch (Exception e1) {
+                return null;
+            }
+            
+            Element e = sdoc.getDocumentElement();
+            // XXX A problem can occur with the ibm jdk when the XmlSchema
+            // object is serialized. The xmlns declaration gets incorrectly
+            // set to the same value as the targetNamespace attribute.
+            // The aegis databinding tests demonstrate this particularly.
+            if (e.getPrefix() == null
+                && !WSDLConstants.NU_SCHEMA_XSD.equals(e.getAttributeNS(WSDLConstants.NU_XMLNS,
+                                                                        WSDLConstants.NP_XMLNS))) {
+                e.setAttributeNS(WSDLConstants.NU_XMLNS, 
+                                 WSDLConstants.NP_XMLNS, 
+                                 WSDLConstants.NU_SCHEMA_XSD);
+            }
+            setElement(e);
+        }
         return element;
     }
 

Modified: incubator/cxf/branches/2.0.x-fixes/parent/pom.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/parent/pom.xml?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/parent/pom.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/parent/pom.xml Wed Oct 17 07:22:06 2007
@@ -432,7 +432,7 @@
             <dependency>
                 <groupId>org.apache.ws.commons.schema</groupId>
                 <artifactId>XmlSchema</artifactId>
-                <version>1.2</version>
+                <version>1.3.2</version>
             </dependency>
             <dependency>
                 <groupId>javax.xml.soap</groupId>

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/databinding/source/AbstractDataBinding.java Wed Oct 17 07:22:06 2007
@@ -28,6 +28,7 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
+import org.apache.cxf.common.util.FixedExtensionDeserializer;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
@@ -66,10 +67,9 @@
                 }
             }
         }
-        
         SchemaInfo schema = new SchemaInfo(serviceInfo, ns);
-        schema.setElement(d.getDocumentElement());
         schema.setSystemId(systemId);
+        col.getExtReg().setDefaultExtensionDeserializer(new FixedExtensionDeserializer());
         XmlSchema xmlSchema = col.read(d.getDocumentElement());
         schema.setSchema(xmlSchema);
         serviceInfo.addSchema(schema);

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/ServiceWSDLBuilder.java Wed Oct 17 07:22:06 2007
@@ -52,11 +52,11 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
+
 import com.ibm.wsdl.extensions.schema.SchemaImpl;
 import org.apache.cxf.Bus;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.XMLUtils;
-import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.model.AbstractMessageContainer;
 import org.apache.cxf.service.model.AbstractPropertiesHolder;
 import org.apache.cxf.service.model.BindingFaultInfo;
@@ -72,8 +72,6 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.wsdl.WSDLConstants;
 import org.apache.cxf.wsdl.WSDLManager;
-import org.apache.ws.commons.schema.XmlSchemaSerializer;
-import org.apache.ws.commons.schema.XmlSchemaSerializer.XmlSchemaSerializerException;
 
 public final class ServiceWSDLBuilder {
     
@@ -191,28 +189,6 @@
         doc.appendChild(nd);
         
         for (SchemaInfo schemaInfo : schemas) {
-            
-            if (schemaInfo.getSchema() != null) {
-                Document[] docs;
-                try {
-                    docs = XmlSchemaSerializer.serializeSchema(schemaInfo.getSchema(), false);
-                } catch (XmlSchemaSerializerException e1) {
-                    throw new ServiceConstructionException(e1);
-                }
-                Element e = docs[0].getDocumentElement();
-                // XXX A problem can occur with the ibm jdk when the XmlSchema
-                // object is serialized. The xmlns declaration gets incorrectly
-                // set to the same value as the targetNamespace attribute.
-                // The aegis databinding tests demonstrate this particularly.
-                if (e.getPrefix() == null
-                    && !WSDLConstants.NU_SCHEMA_XSD.equals(e.getAttributeNS(WSDLConstants.NU_XMLNS,
-                                                                            WSDLConstants.NP_XMLNS))) {
-                    e.setAttributeNS(WSDLConstants.NU_XMLNS, 
-                                     WSDLConstants.NP_XMLNS, 
-                                     WSDLConstants.NU_SCHEMA_XSD);
-                }
-                schemaInfo.setElement(e);
-            }
             
             if (!useSchemaImports) {
                 SchemaImpl schemaImpl = new SchemaImpl();

Modified: incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/core/src/main/java/org/apache/cxf/wsdl11/WSDLServiceBuilder.java Wed Oct 17 07:22:06 2007
@@ -62,6 +62,7 @@
 import org.apache.cxf.catalog.CatalogXmlSchemaURIResolver;
 import org.apache.cxf.catalog.OASISCatalogManager;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.common.util.FixedExtensionDeserializer;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.service.model.AbstractMessageContainer;
 import org.apache.cxf.service.model.AbstractPropertiesHolder;
@@ -273,6 +274,8 @@
     private XmlSchemaCollection getSchemas(Definition def, ServiceInfo serviceInfo) {
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
         serviceInfo.setXmlSchemaCollection(schemaCol);
+        schemaCol.getExtReg().setDefaultExtensionDeserializer(
+            new FixedExtensionDeserializer());
 
         List<Definition> defList = new ArrayList<Definition>();
         parseImports(def, defList);

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/TestServiceTest.java Wed Oct 17 07:22:06 2007
@@ -19,6 +19,9 @@
 package org.apache.cxf.systest.jaxb;
 
 
+import java.net.URL;
+
+import org.apache.cxf.helpers.IOUtils;
 import org.apache.cxf.systest.jaxb.model.ExtendedWidget;
 import org.apache.cxf.systest.jaxb.model.Widget;
 import org.apache.cxf.systest.jaxb.service.TestService;
@@ -37,13 +40,18 @@
 
     @Test
     public void testExtraSubClassWithJaxb() throws Throwable {
-
         Widget expected = new ExtendedWidget(42, "blah", "blah", true, true);
 
         Widget widgetFromService = testClient.getWidgetById((long)42);
 
         assertEquals(expected, widgetFromService);
-
+    }
+    
+    @Test
+    public void testSchema() throws Exception {
+        URL url = new URL("http://localhost:7081/service/TestService?wsdl");
+        String s = IOUtils.toString(url.openStream());
+        assertTrue(s, s.contains("application/octet-stream"));
     }
 
     /*

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxb/model/jaxb.index Wed Oct 17 07:22:06 2007
@@ -15,4 +15,5 @@
 # specific language governing permissions and limitations
 # under the License.
 Widget
-ExtendedWidget
\ No newline at end of file
+ExtendedWidget
+ExtendedWidgetWithMime
\ No newline at end of file

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/ws/policy/rmwsdl.xml Wed Oct 17 07:22:06 2007
@@ -26,7 +26,7 @@
 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
     <http:conduit name="{http://cxf.apache.org/greeter_control}GreeterPort.http-conduit">
-      <http:client DecoupledEndpoint="http://localhost:9999/decoupled_endpoint"/>
+      <http:client DecoupledEndpoint="http://localhost:9998/decoupled_endpoint"/>
     </http:conduit>
 
     <bean id="org.apache.cxf.ws.policy.PolicyEngine" class="org.apache.cxf.ws.policy.spring.InitializingPolicyEngine">

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/ValidatorUtil.java Wed Oct 17 07:22:06 2007
@@ -77,6 +77,7 @@
         //
         baseURI = baseURI.replaceAll(" ", "%20");
         XmlSchemaCollection schemaCol = new XmlSchemaCollection();
+        schemaCol.setBaseUri(baseURI);
         NodeList nodes = document.getElementsByTagNameNS(
             WSDLConstants.NU_SCHEMA_XSD, "schema");
         for (int x = 0; x < nodes.getLength(); x++) {

Modified: incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java?rev=585517&r1=585516&r2=585517&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java Wed Oct 17 07:22:06 2007
@@ -35,6 +35,7 @@
         try {
             assertFalse(validator.isValid());
         } catch (Exception e) {
+            e.printStackTrace();
             assertTrue(e.getMessage().indexOf("Caused by {http://apache.org/hello_world/messages}"
                                               + "[portType:GreeterA][operation:sayHi] not exist.") != -1);
         }