You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by bi...@apache.org on 2007/11/02 14:31:06 UTC
svn commit: r591325 - in /incubator/cxf/trunk:
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: bimargulies
Date: Fri Nov 2 06:31:06 2007
New Revision: 591325
URL: http://svn.apache.org/viewvc?rev=591325&view=rev
Log:
Fix CXF-1168.
Added:
incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl
Modified:
incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
Modified: incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java?rev=591325&r1=591324&r2=591325&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java (original)
+++ incubator/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/TypeClassInitializer.java Fri Nov 2 06:31:06 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/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java?rev=591325&r1=591324&r2=591325&view=diff
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/jaxws/ClientServerTest.java Fri Nov 2 06:31:06 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 {
Added: incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl?rev=591325&view=auto
==============================================================================
--- incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl (added)
+++ incubator/cxf/trunk/testutils/src/main/resources/wsdl/dynamic_client_base64.wsdl Fri Nov 2 06:31:06 2007
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+ xmlns:ns1="http://rpc.data.webservicestudio.inforsense.com/"
+ xmlns:ns2="http://schemas.xmlsoap.org/soap/http"
+ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="DataTestService"
+ targetNamespace="http://rpc.data.webservicestudio.inforsense.com/">
+ <wsdl:types>
+ <xsd:schema
+ xmlns="http://rpc.data.webservicestudio.inforsense.com/"
+ attributeFormDefault="unqualified" elementFormDefault="qualified"
+ targetNamespace="http://rpc.data.webservicestudio.inforsense.com/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <xsd:element name="UnsupportedEncodingException"
+ type="UnsupportedEncodingException" />
+ <xsd:complexType name="UnsupportedEncodingException">
+ <xsd:sequence>
+ <xsd:element name="message" nillable="true"
+ type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="getStringResponse">
+ <wsdl:part name="return" type="xsd:string"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="getString">
+ <wsdl:part name="arg0" type="xsd:base64Binary"></wsdl:part>
+ <wsdl:part name="arg1" type="xsd:string"></wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="UnsupportedEncodingException">
+ <wsdl:part element="ns1:UnsupportedEncodingException"
+ name="fault">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="TestService">
+ <wsdl:operation name="getString">
+ <wsdl:input message="ns1:getString" name="getString">
+ </wsdl:input>
+ <wsdl:output message="ns1:getStringResponse"
+ name="getStringResponse">
+ </wsdl:output>
+ <wsdl:fault message="ns1:UnsupportedEncodingException"
+ name="UnsupportedEncodingException">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="DataTestServiceSoapBinding"
+ type="ns1:TestService">
+ <soap:binding style="rpc"
+ transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getString">
+ <soap:operation soapAction="" style="rpc" />
+ <wsdl:input name="getString">
+ <soap:body
+ namespace="http://rpc.data.webservicestudio.inforsense.com/"
+ use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getStringResponse">
+ <soap:body
+ namespace="http://rpc.data.webservicestudio.inforsense.com/"
+ use="literal" />
+ </wsdl:output>
+ <wsdl:fault name="UnsupportedEncodingException">
+ <soap:fault name="UnsupportedEncodingException"
+ use="literal" />
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="DataTestService">
+ <wsdl:port binding="ns1:DataTestServiceSoapBinding"
+ name="TestServiceImplPort">
+ <soap:address location="http://localhost:9004/data" />
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
+
+
+