svn commit: r963312 - /axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java
Author: scheu Date: Mon Jul 12 15:07:56 2010 New Revision: 963312 URL: http://svn.apache.org/viewvc?rev=963312&view=rev Log: AXIS2-4700 Committer:Rich Scheuerle Tweaked fix to ensure the wrapper class is JAXB enabled. Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java?rev=963312&r1=963311&r2=963312&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Mon Jul 12 15:07:56 2010 @@ -19,12 +19,18 @@ package org.apache.axis2.jaxws.runtime.description.marshal.impl; +import java.lang.annotation.Annotation; +import java.lang.reflect.AnnotatedElement; import java.lang.reflect.Method; +import java.security.PrivilegedAction; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Map; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + import org.apache.axis2.java.security.AccessController; import org.apache.axis2.jaxws.Constants; import org.apache.axis2.jaxws.ExceptionFactory; @@ -191,10 +197,10 @@ class ArtifactProcessor { String wrapperClass = null; try { -Class cls = null; + ClassLoader cl = getContextClassLoader(); if (providedValue != null && providedValue.length() > 0) { - +Class cls = null; // If a className is provided try to load it with the context classloader // and then the alternate classloader. // If the class still cannot be loaded, then try inserting the @@ -274,6 +280,14 @@ class ArtifactProcessor { // wrapper to get pulled in firstthus the jaxws wrapper will cause a collision. // // Thus the following algorithm with check the non-jaxws package first + +Class cls1 = null; // Class from the non-JAXWS package +Class cls2 = null; // Class from the JAX-WS package +boolean cls1IsJAXB = false; +boolean cls2IsJAXB = false; + + +// Look for the class in the non-jaxws package first String defaultValue = null; if (defaultPkg.length() > 0) { defaultValue = defaultPkg + "." + defaultClassName; @@ -283,33 +297,28 @@ class ArtifactProcessor { if (log.isDebugEnabled()) { log.debug("No provided value. Try the default class name = " + defaultValue); } -cls = loadClassOrNull(defaultValue, cl); +cls1 = loadClassOrNull(defaultValue, cl); -if (cls == null) { -cls = loadClassOrNull(defaultValue, altClassLoader); +if (cls1 == null) { +cls1 = loadClassOrNull(defaultValue, altClassLoader); } -if (cls != null) { -wrapperClass = defaultValue; +if (cls1 != null) { +cls1IsJAXB = isJAXB(cls1); } -// Now try the one in the jaxws subpackage -if (cls == null) { +// Now try the one in the jaxws subpackage (if cls1 is missing or perhaps not a JAXB class) +if (cls1 == null || !cls1IsJAXB) { if (defaultPkg.length() > 0) { defaultValue = defaultPkg + "." + JAXWS_SUBPACKAGE + "." + defaultClassName; if (log.isDebugEnabled()) { log.debug("Did not find the default name. Try a different default class name = " + defaultValue); } -cls = loadClassOrNull(defaultValue, cl); -if (cls != null) { -wrapperClass = defaultValue; -} else { -cls = loadClassOrNull(defaultValue, altClassLoader); -if (cls != null) { -wrapperClass = defaultValue; -} +cls2 = loadClassOrNull(defaultValue, cl); +if (cls2 == null) { +cls2 = loa
svn commit: r963419 - /axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
Author: scheu Date: Mon Jul 12 18:32:17 2010 New Revision: 963419 URL: http://svn.apache.org/viewvc?rev=963419&view=rev Log: AXIS2-4774 Contributor:Rich Scheuerle During a JAX-WS client proxy invocation determine if the context classloader or the SEI's classloader should be used to marshal the data. Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?rev=963419&r1=963418&r2=963419&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Mon Jul 12 18:32:17 2010 @@ -22,6 +22,7 @@ package org.apache.axis2.jaxws.client.pr import org.apache.axis2.addressing.AddressingConstants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.addressing.AddressingConstants.Final; +import org.apache.axis2.java.security.AccessController; import org.apache.axis2.jaxws.BindingProvider; import org.apache.axis2.jaxws.ExceptionFactory; import org.apache.axis2.jaxws.client.async.AsyncResponse; @@ -37,7 +38,10 @@ import org.apache.axis2.jaxws.descriptio import org.apache.axis2.jaxws.i18n.Messages; import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory; import org.apache.axis2.jaxws.message.Message; +import org.apache.axis2.jaxws.message.databinding.JAXBUtils; import org.apache.axis2.jaxws.registry.FactoryRegistry; +import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescription; +import org.apache.axis2.jaxws.runtime.description.marshal.MarshalServiceRuntimeDescriptionFactory; import org.apache.axis2.jaxws.spi.Binding; import org.apache.axis2.jaxws.spi.Constants; import org.apache.axis2.jaxws.spi.ServiceDelegate; @@ -47,7 +51,9 @@ import org.apache.axis2.transport.http.H import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import javax.xml.bind.JAXBContext; import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Holder; import javax.xml.ws.Response; import javax.xml.ws.WebServiceException; import javax.xml.ws.WebServiceFeature; @@ -55,6 +61,8 @@ import javax.xml.ws.soap.SOAPBinding; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Method; import java.lang.reflect.Modifier; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -463,6 +471,14 @@ public class JAXWSProxyHandler extends B OperationDescription operationDesc = endpointDesc.getEndpointInterfaceDescription().getOperation(method); +MessageContext request = new MessageContext(); + +// Select a Classloader to use for marshaling +ClassLoader cl = chooseClassLoader(seiClazz, serviceDesc); + +// Make sure the same classloader is used on the response +request.setProperty(Constants.CACHE_CLASSLOADER, cl); + Message message = MethodMarshallerFactory.getMarshaller(operationDesc, true, null) .marshalRequest(args, operationDesc, this.getRequestContext()); @@ -470,7 +486,6 @@ public class JAXWSProxyHandler extends B log.debug("Request Message created successfully."); } -MessageContext request = new MessageContext(); request.setMessage(message); if (log.isDebugEnabled()) { @@ -505,7 +520,27 @@ public class JAXWSProxyHandler extends B Throwable t = getFaultResponse(responseContext, operationDesc); throw t; } + +// Get the classloader that was used for the request processing ClassLoader cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER); +if (cl == null) { +InvocationContext ic = responseContext.getInvocationContext(); +if (ic != null) { +MessageContext requestMC = ic.getRequestMessageContext(); +if (requestMC != null) { +cl = (ClassLoader) responseContext.getProperty(Constants.CACHE_CLASSLOADER); +if (cl != null) { +if (log.isDebugEnabled()) { +log.debug("Obtained ClassLoader for the request context: " + cl); +} +} +} +} +} else { +if (log.isDebugEnabled(
svn commit: r963459 - in /axis/axis2/java/core/trunk/modules: jaxws-integration/test/org/apache/axis2/jaxws/proxy/ jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/ jaxws-integration/te
Author: scheu Date: Mon Jul 12 20:08:38 2010 New Revision: 963459 URL: http://svn.apache.org/viewvc?rev=963459&view=rev Log: AXIS2-4765 Contributor:Rich Scheuerle Inspect generics to determine how to build a JAXBContext for JAX-WS applications. Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/utility/ClassUtilsTests.java Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/GorillaProxyImpl.java axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/sei/GorillaInterface.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSetBuilder.java axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/utility/ClassUtils.java Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java?rev=963459&r1=963458&r2=963459&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/GorillaDLWProxyTests.java Mon Jul 12 20:08:38 2010 @@ -159,6 +159,8 @@ public class GorillaDLWProxyTests extend assertTrue(observedKey.contains("org.apache.axis2.jaxws.proxy.gorilla_dlw.data")); // Check for the package referenced only by an @XmlSeeAlso assertTrue(observedKey.contains("org.test.stock2")); +// Check for the package referenced in the return type List<> generic +assertTrue(observedKey.contains("org.test.stock1")); } @@ -178,6 +180,8 @@ public class GorillaDLWProxyTests extend assertTrue(observedKey.contains("org.apache.axis2.jaxws.proxy.gorilla_dlw.data")); // Check for the package referenced only by an @XmlSeeAlso assertTrue(observedKey.contains("org.test.stock2")); +// Check for the package referenced in the return type List<> generic +assertTrue(observedKey.contains("org.test.stock1")); } }catch(Exception e){ e.printStackTrace(); Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/GorillaProxyImpl.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/GorillaProxyImpl.java?rev=963459&r1=963458&r2=963459&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/GorillaProxyImpl.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/GorillaProxyImpl.java Mon Jul 12 20:08:38 2010 @@ -150,5 +150,11 @@ public class GorillaProxyImpl implements } } + + /** + * The following non-doc method is not invoked. It is only present to test the + * generic reflection code. + */ + public List sampleMethod() { return null;} } Modified: axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/sei/GorillaInterface.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/sei/GorillaInterface.java?rev=963459&r1=963458&r2=963459&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/sei/GorillaInterface.java (original) +++ axis/axis2/java/core/trunk/modules/jaxws-integration/test/org/apache/axis2/jaxws/proxy/gorilla_dlw/sei/GorillaInterface.java Mon Jul 12 20:08:38 2010 @@ -331,4 +331,11 @@ public interface GorillaInterface { public void echoPolymorphicDate( @WebParam(name = "request", targetNamespace = "http://org/apache/axis2/jaxws/proxy/gorilla_dlw/data";) XMLGregorianCalendar request); + +/** + * The following non-doc method is not invoked. It is only present to test the + * generic reflection code. + */ +@WebMethod +public List sampleMethod(); } Modified: axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/PackageSet
svn commit: r963508 - in /axis/axis2/java/core/trunk/modules/jaxws: ./ src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ test/org/apache/axis2/jaxws/wrapper/ test/org/apache/axis2/jaxws/wra
Author: nthaker Date: Mon Jul 12 22:16:54 2010 New Revision: 963508 URL: http://svn.apache.org/viewvc?rev=963508&view=rev Log: AXIS2-4775 This change ensures that we will use Request and Response wrapper Bean packaged by customer or we will Generate Wrappers if they are not packaged. Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml axis/axis2/java/core/trunk/modules/jaxws/src/org/apache/axis2/jaxws/runtime/description/marshal/impl/ArtifactProcessor.java Modified: axis/axis2/java/core/trunk/modules/jaxws/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/pom.xml?rev=963508&r1=963507&r2=963508&view=diff == --- axis/axis2/java/core/trunk/modules/jaxws/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/jaxws/pom.xml Mon Jul 12 22:16:54 2010 @@ -1,5 +1,4 @@ - http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";> 4.0.0 org.apache.axis2 @@ -98,7 +97,25 @@ ${version} test + +wsdl4j +wsdl4j + + +com.sun.xml.ws +jaxws-tools +2.1.3 + + + +java +tools +$version +system +${JAVA_HOME}/lib/tools.jar + + src test @@ -203,34 +220,39 @@ 1.5 1.5 1.5 + org.apache.maven.plugins maven-antrun-plugin + gen-ts generate-test-sources - + - + + + Generating JAX-B classes from XSDs Generating java from echo.xsd + @@ -266,7 +288,7 @@ - + @@ -287,6 +309,22 @@ + + + + + + + + + + + + + + + @@ -374,6 +412,13 @@