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/11/02 15:03:00 UTC

svn commit: r591335 - in /incubator/cxf/branches/2.0.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ systests/src/test/java/org/apache/cxf/systest/jaxws/ testutils/src/main/resources/wsdl/

Author: dkulp
Date: Fri Nov  2 07:02:58 2007
New Revision: 591335

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

........
  r591325 | bimargulies | 2007-11-02 09:31:06 -0400 (Fri, 02 Nov 2007) | 2 lines
  
  Fix CXF-1168.
........

Added:
    incubator/cxf/branches/2.0.x-fixes/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl
      - copied unchanged from r591325, incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl
Modified:
    incubator/cxf/branches/2.0.x-fixes/   (props changed)
    incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
    incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java

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

Modified: incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java?rev=591335&r1=591334&r2=591335&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java Fri Nov  2 07:02:58 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.endpoint.dynamic;
 
+import java.lang.reflect.Array;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -83,12 +84,24 @@
             
         Class cls;
         
-        //JClass jclass;
         try {
-            if (!jType.isPrimitive()) {
-                cls = ClassLoaderUtils.loadClass(jType.fullName(), getClass());
-            } else {
-                cls = PrimitiveUtils.getClass(jType.fullName());
+            int arrayCount = 0;
+            JType rootType = jType;
+            while (rootType.isArray()) {
+                rootType = rootType.elementType();
+                arrayCount++;
+            }
+            cls = getClassByName(rootType);
+            // bmargulies cannot find a way to ask the JVM to do this without creating 
+            // an array object on the way.
+            if (arrayCount > 0) {
+                int[] dimensions = new int[arrayCount];
+                while (arrayCount > 0) {
+                    arrayCount--;
+                    dimensions[arrayCount] = 0;
+                }
+                Object emptyArray = Array.newInstance(cls, dimensions);
+                cls = emptyArray.getClass();
             }
         } catch (ClassNotFoundException e) {
             throw new ServiceConstructionException(e);
@@ -97,6 +110,17 @@
         part.setTypeClass(cls);
         
         super.begin(part);
+    }
+
+    private Class getClassByName(JType jType) throws ClassNotFoundException {
+        Class cls;
+        
+        if (!jType.isPrimitive()) {
+            cls = ClassLoaderUtils.loadClass(jType.fullName(), getClass());
+        } else {
+            cls = PrimitiveUtils.getClass(jType.fullName());
+        }
+        return cls;
     }
 
 }

Modified: incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=591335&r1=591334&r2=591335&view=diff
==============================================================================
--- incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ incubator/cxf/branches/2.0.x-fixes/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Fri Nov  2 07:02:58 2007
@@ -19,8 +19,6 @@
 
 package org.apache.cxf.systest.jaxws;
 
-
-
 import java.io.InputStream;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
@@ -52,7 +50,9 @@
 import org.w3c.dom.Node;
 
 //import org.apache.cxf.Bus;
+import org.apache.cxf.Bus;
 import org.apache.cxf.binding.soap.Soap11;
+import org.apache.cxf.bus.CXFBusFactory;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.security.AuthorizationPolicy;
 import org.apache.cxf.endpoint.Client;
@@ -102,6 +102,18 @@
         assertTrue("server did not launch correctly", launchServer(Server.class));
     }
 
+    @Test
+    public void testBase64() throws URISyntaxException  {
+        URL wsdl = getClass().getResource("/wsdl/dynamic_client_base64.wsdl");
+        assertNotNull(wsdl);
+        String wsdlUrl = null;
+        wsdlUrl = wsdl.toURI().toString();
+        CXFBusFactory busFactory = new CXFBusFactory(); 
+        Bus bus = busFactory.createBus();
+        DynamicClientFactory dynamicClientFactory = DynamicClientFactory.newInstance(bus);
+        Client client = dynamicClientFactory.createClient(wsdlUrl);
+        assertNotNull(client);
+    }
         
     @Test
     public void testBasicConnection() throws Exception {