Return-Path: Delivered-To: apmail-axis-java-dev-archive@www.apache.org Received: (qmail 31397 invoked from network); 14 Jul 2010 19:42:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 14 Jul 2010 19:42:46 -0000 Received: (qmail 34939 invoked by uid 500); 14 Jul 2010 19:42:45 -0000 Delivered-To: apmail-axis-java-dev-archive@axis.apache.org Received: (qmail 34772 invoked by uid 500); 14 Jul 2010 19:42:44 -0000 Mailing-List: contact java-dev-help@axis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@axis.apache.org Delivered-To: mailing list java-dev@axis.apache.org Received: (qmail 34764 invoked by uid 99); 14 Jul 2010 19:42:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 19:42:44 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of nikhil.v.thaker@us.ibm.com designates 32.97.182.146 as permitted sender) Received: from [32.97.182.146] (HELO e6.ny.us.ibm.com) (32.97.182.146) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Jul 2010 19:42:32 +0000 Received: from d01relay05.pok.ibm.com (d01relay05.pok.ibm.com [9.56.227.237]) by e6.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id o6EJfBq8003834 for ; Wed, 14 Jul 2010 15:41:11 -0400 Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay05.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o6EJgAmu137014 for ; Wed, 14 Jul 2010 15:42:10 -0400 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o6EJgAuK021674 for ; Wed, 14 Jul 2010 15:42:10 -0400 Received: from d01ml263.pok.ibm.com (d01ml263.pok.ibm.com [9.56.227.113]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o6EJgA4v021666 for ; Wed, 14 Jul 2010 15:42:10 -0400 In-Reply-To: References: <20100712221655.09FF7238899C@eris.apache.org> To: java-dev@axis.apache.org Cc: java-dev@axis.apache.org MIME-Version: 1.0 Subject: Re: 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/wrapper/beans/ X-KeepSent: 54D6B317:72FF0BE7-86257760:006C0683; type=4; name=$KeepSent X-Mailer: Lotus Notes Release 8.0.2 HF623 January 16, 2009 From: Nikhil V Thaker Message-ID: Date: Wed, 14 Jul 2010 15:42:08 -0400 X-MIMETrack: Serialize by Router on D01ML263/01/M/IBM(Release 8.0.1|February 07, 2008) at 07/14/2010 15:42:09, Serialize complete at 07/14/2010 15:42:09 Content-Type: multipart/alternative; boundary="=_alternative 006C391C86257760_=" X-Virus-Checked: Checked by ClamAV on apache.org --=_alternative 006C391C86257760_= Content-Type: text/plain; charset="US-ASCII" Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar. Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency. Thanks, Nikhil Thaker office: 919 254 9964 nvthaker@us.ibm.com Andreas Veithen 07/14/2010 01:44 PM Please respond to java-dev@axis.apache.org To java-dev@axis.apache.org cc Subject Re: 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/wrapper/beans/ Nikhil, I have some issues with the tools and jaxws-tools dependencies introduced by this change: * The change causes a build failure in Hudson. There will also be additional issues with tools.jar, because the way to declare this as a system dependency varies from one JDK to another. For example, I remember that on Mac OS X, it is completely different than on other JDKs. * I don't like the fact that jaxws-tools becomes a dependency of axis2-jaxws in scope compile, because it looks like this is only needed during the build and/or during the tests. I didn't review the change in detail, but wouldn't it be smarter to use one of the existing Maven plugins to do the wsgen stuff? They will take care of the tools.jar stuff as well. Andreas On Tue, Jul 13, 2010 at 00:16, wrote: > 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 @@ > > - > > > - 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 > > - > + > > > > - > + > > value="${schema.output.base.dir}/classes"/> > + > > > > > + > > Generating JAX-B classes from XSDs > > Generating java from echo.xsd > > > + > > > > @@ -266,7 +288,7 @@ > > > > - > + > > > > @@ -287,6 +309,22 @@ > > dir="." target="build-repo"/> > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + + dir="." target="run-wsgen-tests"/> > > > > @@ -374,6 +412,13 @@ > > org.apache.maven.plugins > maven-surefire-report-plugin > + > + > + > + report-only > + > + > + > > > > > 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=963508&r1=963507&r2=963508&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 22:16:54 2010 > @@ -238,12 +238,27 @@ class ArtifactProcessor { > wrapperClass = newValue; > } > } > - if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){ > + > + if(cls==null && > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){ > + > + //Support for Fault Bean Generation > //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to > //package the faultBeans, if we have reached this point in the code then user has choosen > //not to package the fault bean. If there is a cache of generated artifacts available then > //lets look for the missing faultBean there. > - > + > + //Support for Wrapper Bean Generation > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use > + //the wrapper bean classes, so the application need not package these classes. If we have reached > + //this point in the code then user has choosen not to package these beans. > + > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum. > + if(log.isDebugEnabled()){ > + log.debug("Adding cache to classpath"); > + } > ClassFinderFactory cff = > (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class); > ClassFinder cf = cff.getClassFinder(); > @@ -317,11 +332,26 @@ class ArtifactProcessor { > if (cls2 == null) { > cls2 = loadClassOrNull(defaultValue, altClassLoader); > } > - if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){ > - //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to > - //package the faultBeans, if we have reached this point in the code then user has choosen > - //not to package the fault bean. If there is a cache of generated artifacts available then > - //lets look for the missing faultBean there. > + if(cls2==null && > + (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){ > + > + //Support for Fault Bean Generation > + //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to > + //package the faultBeans, if we have reached this point in the code then user has choosen > + //not to package the fault bean. If there is a cache of generated artifacts available then > + //lets look for the missing faultBean there. > + > + //Support for Wrapper Bean Generation > + //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use > + //the wrapper bean classes, so the application need not package these classes. If we have reached > + //this point in the code then user has choosen not to package these beans. > + > + //NOTE:If we find Generated artifacts from cache this guarantees that we will not use > + //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is > + //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum. > + if(log.isDebugEnabled()){ > + log.debug("Adding cache to classpath"); > + } > if(log.isDebugEnabled()){ > log.debug("Adding cache to classpath"); > } > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto > ============================================================================== > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added) > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010 > @@ -0,0 +1,18 @@ > + > +package org.apache.axis2.jaxws.wrapper.beans; > + > +import javax.xml.ws.WebFault; > + > +@WebFault(name = "AddNumbersFault", targetNamespace = " http://org/test/addnumbers") > +public class AddNumbersException extends Exception > +{ > + > + private String message = null; > + public AddNumbersException(){} > + public AddNumbersException(String message){ > + this.message = message; > + } > + public String getInfo(){ > + return message; > + } > +} > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto > ============================================================================== > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added) > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010 > @@ -0,0 +1,15 @@ > +package org.apache.axis2.jaxws.wrapper.beans; > + > + > + > +@javax.jws.WebService (targetNamespace="http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort") > +public class AddNumbersService{ > + > + public int addNumbers(int arg0, int arg1) throws AddNumbersException { > + if(arg0+arg1<0){ > + throw new AddNumbersException("sum is less than 0"); > + } > + return arg0+arg1; > + } > + > +} > \ No newline at end of file > > Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto > ============================================================================== > --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added) > +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010 > @@ -0,0 +1,114 @@ > +/** > + * > + */ > +package org.apache.axis2.jaxws.wrapper.beans; > + > + > +import org.apache.axis2.jaxws.Constants; > +import org.apache.axis2.jaxws.description.DescriptionFactory; > +import org.apache.axis2.jaxws.description.EndpointDescription; > +import org.apache.axis2.jaxws.description.EndpointDescriptionJava; > +import org.apache.axis2.jaxws.description.OperationDescription; > +import org.apache.axis2.jaxws.description.ServiceDescription; > +import org.apache.axis2.jaxws.marshaller.MethodMarshaller; > +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory; > +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller; > +import org.apache.axis2.jaxws.unitTest.TestLogger; > + > +import java.io.File; > + > +import junit.framework.TestCase; > + > +public class WrapperBeanMarshallTests extends TestCase { > + /** > + * This is the negative test case, when we do not use generated artifacts from cache > + * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller. > + */ > + public void testGetMarshallerOperationDescriptionBooleanNegative() { > + TestLogger.logger.debug("---------------------------------------"); > + TestLogger.logger.debug("test: " + getName()); > + > + String cache_location = "/target/wscache/classes"; > + try{ > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath(); > + cache_location = new File(baseDir+cache_location).getAbsolutePath(); > + TestLogger.logger.debug("cache location ="+cache_location); > + > + //Get EndpointDescription. > + //Set location on AxisConfiguraiton. > + Class sei = AddNumbersService.class; > + EndpointDescription description = getEndpointDesc(sei); > + TestLogger.logger.debug("description objects where created successfully"); > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations(); > + assertNotNull( "OperationDescriptions where null", ops); > + assertTrue("No Operation Descriptions where found", ops.length>0); > + OperationDescription op = ops[0]; > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName()); > + //Don not Set cache on AxisConfiguration. > + //get Marshaller, verify its not DoclitWrappedMinimum. > + TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location); > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false); > + assertNotNull("getMarshaller returned null", mm ); > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName()); > + assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller)); > + }catch(Exception e){ > + TestLogger.logger.debug("Exception ="+e.getMessage()); > + fail(e.getMessage()); > + } > + > + } > + /** > + * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of > + * DocLitWrappedMarshaller. > + * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}. > + */ > + public void testGetMarshallerOperationDescriptionBoolean() { > + TestLogger.logger.debug("---------------------------------------"); > + TestLogger.logger.debug("test: " + getName()); > + > + String cache_location = "/target/wscache/classes"; > + try{ > + String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath(); > + cache_location = new File(baseDir+cache_location).getAbsolutePath(); > + TestLogger.logger.debug("cache location ="+cache_location); > + > + //Get EndpointDescription. > + //Set location on AxisConfiguraiton. > + Class sei = AddNumbersService.class; > + EndpointDescription description = getEndpointDesc(sei); > + TestLogger.logger.debug("description objects where created successfully"); > + OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations(); > + assertNotNull( "OperationDescriptions where null", ops); > + assertTrue("No Operation Descriptions where found", ops.length>0); > + OperationDescription op = ops[0]; > + TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName()); > + //Set cache on AxisConfiguration. > + //get Marshaller, verify its not DoclitWrappedMinimum. > + description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location); > + TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location); > + MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false); > + assertNotNull("getMarshaller returned null", mm ); > + TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName()); > + assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller)); > + }catch(Exception e){ > + TestLogger.logger.debug("Exception ="+e.getMessage()); > + fail(e.getMessage()); > + } > + > + } > + > + private EndpointDescription getEndpointDesc(Class implementationClass) { > + // Use the description factory directly; this will be done within the JAX-WS runtime > + ServiceDescription serviceDesc = > + DescriptionFactory.createServiceDescription(implementationClass); > + assertNotNull(serviceDesc); > + > + EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions(); > + assertNotNull(endpointDesc); > + assertEquals(1, endpointDesc.length); > + > + // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)? Currently assumes [0] > + EndpointDescription testEndpointDesc = endpointDesc[0]; > + return testEndpointDesc; > + } > +} > > Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml > URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto > ============================================================================== > --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added) > +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010 > @@ -0,0 +1,34 @@ > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + > + Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService > + + sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService" > + destdir="${wscache.generated.classes.dir}" > + resourcedestdir="${wscache.generated.src.dir}" > + keep="false" > + verbose="false" > + genwsdl="true"> > + > + > + > + > + > + > \ No newline at end of file > > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org For additional commands, e-mail: java-dev-help@axis.apache.org --=_alternative 006C391C86257760_= Content-Type: text/html; charset="US-ASCII"
Andreas - I had to add the tools.jar bit because maven plugin for wsGen gave NoClassDef Found errors for classes packaged in tools.jar.

Since this is causing a problem I will just package the generated artifacts and remove the wsGen dependency.

Thanks,

Nikhil Thaker
office: 919 254 9964
nvthaker@us.ibm.com



Andreas Veithen <andreas.veithen@gmail.com>

07/14/2010 01:44 PM
Please respond to
java-dev@axis.apache.org

To
java-dev@axis.apache.org
cc
Subject
Re: 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/wrapper/beans/





Nikhil,

I have some issues with the tools and jaxws-tools dependencies
introduced by this change:

* The change causes a build failure in Hudson. There will also be
additional issues with tools.jar, because the way to declare this as a
system dependency varies from one JDK to another. For example, I
remember that on Mac OS X, it is completely different than on other
JDKs.

* I don't like the fact that jaxws-tools becomes a dependency of
axis2-jaxws in scope compile, because it looks like this is only
needed during the build and/or during the tests.

I didn't review the change in detail, but wouldn't it be smarter to
use one of the existing Maven plugins to do the wsgen stuff? They will
take care of the tools.jar stuff as well.

Andreas

On Tue, Jul 13, 2010 at 00:16,  <nthaker@apache.org> wrote:
> 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 @@
>  <?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
> @@ -20,7 +19,7 @@
>   -->
>
>  <project xmlns="
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">
>     <modelVersion>4.0.0</modelVersion>
>     <parent>
>         <groupId>org.apache.axis2</groupId>
> @@ -98,7 +97,25 @@
>             <version>${version}</version>
>             <scope>test</scope>
>         </dependency>
> +        <dependency>
> +            <groupId>wsdl4j</groupId>
> +            <artifactId>wsdl4j</artifactId>
> +        </dependency>
> +        <dependency>
> +            <groupId>com.sun.xml.ws</groupId>
> +            <artifactId>jaxws-tools</artifactId>
> +            <version>2.1.3</version>
> +        </dependency>
> +        <!-- If we dont include tools.jar as dependency, maven throws NoClassDefFound on wsGen run -->
> +        <dependency>
> +            <groupId>java</groupId>
> +            <artifactId>tools</artifactId>
> +            <version>$version</version>
> +            <scope>system</scope>
> +            <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
> +        </dependency>
>     </dependencies>
> +
>     <build>
>         <sourceDirectory>src</sourceDirectory>
>         <testSourceDirectory>test</testSourceDirectory>
> @@ -203,34 +220,39 @@
>                     <compilerVersion>1.5</compilerVersion>
>                     <source>1.5</source>
>                     <target>1.5</target>
> +
>                 </configuration>
>             </plugin>
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-antrun-plugin</artifactId>
> +
>                 <executions>
>                     <execution>
>                         <id>gen-ts</id>
>                         <phase>generate-test-sources</phase>
>                         <configuration>
> -                            <tasks unless="maven.test.skip">
> +                            <tasks unless="maven.test.skip">
>                                 <!-- Theres got to be a better way to do this -->
>                                 <property name="schema.source.dir" value="test-resources/xsd"/>
>                                 <property name="wsdl.source.dir" value="test-resources/wsdl"/>
> -                                <property name="schema.output.base.dir" value="target/schema"/>
> +                                <property name="schema.output.base.dir" value="target/schema"/>
>                                 <property name="schema.generated.src.dir" value="${schema.output.base.dir}/src"/>
>                                 <property name="schema.generated.classes.dir"
>                                           value="${schema.output.base.dir}/classes"/>
> +
>                                 <!-- make the dirs -->
>                                 <mkdir dir="${schema.output.base.dir}"/>
>                                 <mkdir dir="${schema.generated.src.dir}"/>
>                                 <mkdir dir="${schema.generated.classes.dir}"/>
> +
>                                 <!-- Run JAXB schema compiler with designated schemas -->
>                                 <echo>Generating JAX-B classes from XSDs</echo>
>
>                                 <echo>Generating java from echo.xsd</echo>
>                                 <java classname="com.sun.tools.xjc.Driver" fork="true">
>                                     <classpath refid="maven.runtime.classpath"/>
> +
>                                     <classpath location="${compiled.classes.dir}"/>
>                                     <arg line="-d ${schema.generated.src.dir} -quiet  ${schema.source.dir}/echo.xsd"/>
>                                 </java>
> @@ -266,7 +288,7 @@
>                                     <classpath refid="maven.runtime.classpath"/>
>                                     <classpath location="${compiled.classes.dir}"/>
>                                     <arg line="-d ${schema.generated.src.dir} -quiet -wsdl ${wsdl.source.dir}/AddNumbers.wsdl"/>
> -                                </java>
> +                                </java>
>                             </tasks>
>                         </configuration>
>                         <goals>
> @@ -287,6 +309,22 @@
>                                 <property name="addressing_version" value="${version}"/>
>                                 <ant antfile="build.xml" inheritall="true" inheritrefs="true"
>                                      dir="." target="build-repo"/>
> +
> +                                                               <property name="compile_classpath" refid="maven.compile.classpath" />
> +                                                               <property name="runtime_classpath" refid="maven.runtime.classpath" />
> +                                                               <property name="test_classpath" refid="maven.test.classpath" />
> +                                                               <property name="plugin_classpath" refid="maven.plugin.classpath" />
> +
> +                                <!-- Defining wsGen task -->
> +                                                               <taskdef name="wsgen" loaderRef="refwsgen" classname="com.sun.tools.ws.ant.WsGen">
> +                                                                       <classpath>
> +                                                                               <path refid="maven.runtime.classpath" />
> +                                                                               <path refid="maven.compile.classpath" />
> +                                                                       </classpath>
> +                                                               </taskdef>
> +                                                               <!-- Invoking test cases that need to generate artifacts using wsGen -->
> +                                <ant antfile="wsgen-tests.xml" inheritall="true" inheritrefs="true"
> +                                     dir="." target="run-wsgen-tests"/>
>                             </tasks>
>                         </configuration>
>                         <goals>
> @@ -374,6 +412,13 @@
>             <plugin>
>                 <groupId>org.apache.maven.plugins</groupId>
>                 <artifactId>maven-surefire-report-plugin</artifactId>
> +                <reportSets>
> +                    <reportSet>
> +                        <reports>
> +                            <report>report-only</report>
> +                        </reports>
> +                    </reportSet>
> +                </reportSets>
>             </plugin>
>         </plugins>
>     </reporting>
>
> 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=963508&r1=963507&r2=963508&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 22:16:54 2010
> @@ -238,12 +238,27 @@ class ArtifactProcessor {
>                                 wrapperClass = newValue;
>                             }
>                         }
> -                        if(cls==null && (type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> +                        if(cls==null &&
> +                            (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> +                            //Support for Fault Bean Generation
>                             //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
>                             //package the faultBeans, if we have reached this point in the code then user has choosen
>                             //not to package the fault bean. If there is a cache of generated artifacts available then
>                             //lets look for the missing faultBean there.
> -
> +
> +                            //Support for Wrapper Bean Generation
> +                            //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> +                            //the wrapper bean classes, so the application need not package these classes. If we have reached
> +                            //this point in the code then user has choosen not to package these beans.
> +
> +                            //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> +                            //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> +                            //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> +                            if(log.isDebugEnabled()){
> +                                log.debug("Adding cache to classpath");
> +                            }
>                             ClassFinderFactory cff =
>                                 (ClassFinderFactory)FactoryRegistry.getFactory(ClassFinderFactory.class);
>                             ClassFinder cf = cff.getClassFinder();
> @@ -317,11 +332,26 @@ class ArtifactProcessor {
>                         if (cls2 == null) {
>                             cls2 = loadClassOrNull(defaultValue, altClassLoader);
>                         }
> -                        if(cls2==null && (type.equals("faultInfo")|| type.equals("@WebFault"))){
> -                            //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> -                            //package the faultBeans, if we have reached this point in the code then user has choosen
> -                            //not to package the fault bean. If there is a cache of generated artifacts available then
> -                            //lets look for the missing faultBean there.
> +                        if(cls2==null &&
> +                                       (type.equals("@RequestWrapper")|| type.equals("@ResponseWrapper")||type.equals("@WebFault")|| type.equals("faultInfo"))){
> +
> +                               //Support for Fault Bean Generation
> +                               //As per JAX-WS 2.2 Specification section 3.7 an application programmer can choose not to
> +                               //package the faultBeans, if we have reached this point in the code then user has choosen
> +                               //not to package the fault bean. If there is a cache of generated artifacts available then
> +                               //lets look for the missing faultBean there.
> +
> +                               //Support for Wrapper Bean Generation
> +                               //As per JAX-WS 2.2 Specificaiton section 3.6.2.1 pg 41 an application programmer does not use
> +                               //the wrapper bean classes, so the application need not package these classes. If we have reached
> +                               //this point in the code then user has choosen not to package these beans.
> +
> +                               //NOTE:If we find Generated artifacts from cache this guarantees that we will not use
> +                               //DocLitWrappedMinimum marshaller code. The advantage of normal DocLitWrappedMarshaller is
> +                               //that it is very robust and has support of lot more datatypes than in DocLitWrappedMinimum.
> +                               if(log.isDebugEnabled()){
> +                                       log.debug("Adding cache to classpath");
> +                               }
>                             if(log.isDebugEnabled()){
>                                 log.debug("Adding cache to classpath");
>                             }
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersException.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,18 @@
> +
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +import javax.xml.ws.WebFault;
> +
> +@WebFault(name = "AddNumbersFault", targetNamespace = "
http://org/test/addnumbers")
> +public class AddNumbersException extends Exception
> +{
> +
> +       private String message = null;
> +       public AddNumbersException(){}
> +       public AddNumbersException(String message){
> +               this.message = message;
> +       }
> +       public String getInfo(){
> +               return message;
> +       }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/AddNumbersService.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,15 @@
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +
> +@javax.jws.WebService (targetNamespace="
http://org/test/addnumbers", serviceName="AddNumbersService", portName="AddNumbersPort")
> +public class AddNumbersService{
> +
> +    public int addNumbers(int arg0, int arg1) throws AddNumbersException {
> +       if(arg0+arg1<0){
> +                       throw new AddNumbersException("sum is less than 0");
> +               }
> +        return arg0+arg1;
> +    }
> +
> +}
> \ No newline at end of file
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/test/org/apache/axis2/jaxws/wrapper/beans/WrapperBeanMarshallTests.java Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,114 @@
> +/**
> + *
> + */
> +package org.apache.axis2.jaxws.wrapper.beans;
> +
> +
> +import org.apache.axis2.jaxws.Constants;
> +import org.apache.axis2.jaxws.description.DescriptionFactory;
> +import org.apache.axis2.jaxws.description.EndpointDescription;
> +import org.apache.axis2.jaxws.description.EndpointDescriptionJava;
> +import org.apache.axis2.jaxws.description.OperationDescription;
> +import org.apache.axis2.jaxws.description.ServiceDescription;
> +import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
> +import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
> +import org.apache.axis2.jaxws.marshaller.impl.alt.DocLitWrappedMinimalMethodMarshaller;
> +import org.apache.axis2.jaxws.unitTest.TestLogger;
> +
> +import java.io.File;
> +
> +import junit.framework.TestCase;
> +
> +public class WrapperBeanMarshallTests extends TestCase {
> +    /**
> +     * This is the negative test case, when we do not use generated artifacts from cache
> +     * and user did not package wrapper beans, we should see use of DocLitWrappedMinumumMarshaller.
> +     */
> +    public void testGetMarshallerOperationDescriptionBooleanNegative() {
> +        TestLogger.logger.debug("---------------------------------------");
> +        TestLogger.logger.debug("test: " + getName());
> +
> +        String cache_location = "/target/wscache/classes";
> +        try{
> +            String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> +            cache_location = new File(baseDir+cache_location).getAbsolutePath();
> +            TestLogger.logger.debug("cache location ="+cache_location);
> +
> +            //Get EndpointDescription.
> +            //Set location on AxisConfiguraiton.
> +            Class sei = AddNumbersService.class;
> +            EndpointDescription description = getEndpointDesc(sei);
> +            TestLogger.logger.debug("description objects where created successfully");
> +            OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> +            assertNotNull( "OperationDescriptions where null", ops);
> +            assertTrue("No Operation Descriptions where found", ops.length>0);
> +            OperationDescription op = ops[0];
> +            TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> +            //Don not Set cache on AxisConfiguration.
> +            //get Marshaller, verify its not DoclitWrappedMinimum.
> +            TestLogger.logger.debug("ws_cache location NOT set on AxisConfigContext, location="+cache_location);
> +            MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> +            assertNotNull("getMarshaller returned null", mm );
> +            TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> +            assertTrue("Generated artifacts not found, Method marshaller should be DocLitWrappedMinimumMarshaller", (mm instanceof DocLitWrappedMinimalMethodMarshaller));
> +        }catch(Exception e){
> +            TestLogger.logger.debug("Exception ="+e.getMessage());
> +            fail(e.getMessage());
> +        }
> +
> +    }
> +    /**
> +     * In this test case user did not package wrapper beans but we add generated artifacts from cache, we should see use of
> +     * DocLitWrappedMarshaller.
> +     * Test method for {@link org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory#getMarshaller(org.apache.axis2.jaxws.description.OperationDescription, boolean)}.
> +     */
> +    public void testGetMarshallerOperationDescriptionBoolean() {
> +        TestLogger.logger.debug("---------------------------------------");
> +        TestLogger.logger.debug("test: " + getName());
> +
> +        String cache_location = "/target/wscache/classes";
> +        try{
> +            String baseDir = new File(System.getProperty("basedir",".")).getCanonicalPath();
> +            cache_location = new File(baseDir+cache_location).getAbsolutePath();
> +            TestLogger.logger.debug("cache location ="+cache_location);
> +
> +            //Get EndpointDescription.
> +            //Set location on AxisConfiguraiton.
> +            Class sei = AddNumbersService.class;
> +            EndpointDescription description = getEndpointDesc(sei);
> +            TestLogger.logger.debug("description objects where created successfully");
> +            OperationDescription[] ops =description.getEndpointInterfaceDescription().getOperations();
> +            assertNotNull( "OperationDescriptions where null", ops);
> +            assertTrue("No Operation Descriptions where found", ops.length>0);
> +            OperationDescription op = ops[0];
> +            TestLogger.logger.debug("operation found, java methodName="+op.getJavaMethodName());
> +            //Set cache on AxisConfiguration.
> +            //get Marshaller, verify its not DoclitWrappedMinimum.
> +            description.getServiceDescription().getAxisConfigContext().setProperty(Constants.WS_CACHE, cache_location);
> +            TestLogger.logger.debug("ws_cache location set on AxisConfigContext, location="+cache_location);
> +            MethodMarshaller mm = MethodMarshallerFactory.getMarshaller(op, false);
> +            assertNotNull("getMarshaller returned null", mm );
> +            TestLogger.logger.debug("MethodMarshaller was created, type="+mm.getClass().getName());
> +            assertTrue("Generated artifacts are in cache, Method marshaller should not be DocLitWrappedMinimumMarshaller", !(mm instanceof DocLitWrappedMinimalMethodMarshaller));
> +        }catch(Exception e){
> +            TestLogger.logger.debug("Exception ="+e.getMessage());
> +            fail(e.getMessage());
> +        }
> +
> +    }
> +
> +    private EndpointDescription getEndpointDesc(Class implementationClass) {
> +        // Use the description factory directly; this will be done within the JAX-WS runtime
> +        ServiceDescription serviceDesc =
> +                DescriptionFactory.createServiceDescription(implementationClass);
> +        assertNotNull(serviceDesc);
> +
> +        EndpointDescription[] endpointDesc = serviceDesc.getEndpointDescriptions();
> +        assertNotNull(endpointDesc);
> +        assertEquals(1, endpointDesc.length);
> +
> +        // TODO: How will the JAX-WS dispatcher get the appropriate port (i.e. endpoint)?  Currently assumes [0]
> +        EndpointDescription testEndpointDesc = endpointDesc[0];
> +        return testEndpointDesc;
> +    }
> +}
>
> Added: axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml
> URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml?rev=963508&view=auto
> ==============================================================================
> --- axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml (added)
> +++ axis/axis2/java/core/trunk/modules/jaxws/wsgen-tests.xml Mon Jul 12 22:16:54 2010
> @@ -0,0 +1,34 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +
> +<project basedir="." default="run-wsgen-tests" name="wsgen-tests">
> +
> +       <property name="wscache.output.base.dir" value="target/wscache" />
> +       <property name="wscache.generated.src.dir" value="${wscache.output.base.dir}/src" />
> +       <property name="wscache.generated.classes.dir" value="${wscache.output.base.dir}/classes" />
> +       <property name="compile.test.classes" value="target/test-classes" />
> +
> +
> +    <target name="run-wsgen-tests" depends="wrapper-beans"/>
> +
> +
> +       <target name="create-cache">
> +               <mkdir dir="${wscache.output.base.dir}" />
> +               <mkdir dir="${wscache.generated.src.dir}" />
> +               <mkdir dir="${wscache.generated.classes.dir}" />
> +       </target>
> +
> +       <target name="wrapper-beans" depends="create-cache">
> +          <echo>Generating artifacts for org.apache.axis2.jaxws.wrapper.beans.AddNumbersService </echo>
> +               <wsgen
> +                 sei="org.apache.axis2.jaxws.wrapper.beans.AddNumbersService"
> +                 destdir="${wscache.generated.classes.dir}"
> +                 resourcedestdir="${wscache.generated.src.dir}"
> +                 keep="false"
> +                 verbose="false"
> +                 genwsdl="true">
> +                 <classpath>
> +                  <pathelement path="${compile.test.classes}" />
> +                  </classpath>
> +               </wsgen>
> +       </target>
> +</project>
> \ No newline at end of file
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


--=_alternative 006C391C86257760_=--