Besides the ant tasks missing some key parameters available in the
commandline version of wsdl2java/java2wsdl (as I mentioned in an earlier
post)...it appears wsdl2java IS missing support for classpath
element...unlike java2wsdl which does have this element.
When using wsdl2java ant task and the "testcase=true" attribute
(generates jUnit test case which needs filling in) it attempts to find
jUnit on the classpath. Since this cannot be specified using Ant, it
requires you have it in your OS environment.
Generally it's not a good idea to put anything in your default classpath
(i.e. jre/lib/ext or classpath env var) as it screws too many things
up...classpaths s/be set explicitly by the requiring application.
Below is an example of java2wsdl axis ant task which works with nested
classpath element and wsdl2java task which doesn't:
<target depends="compile source" description="Generate wsdl"
name="java2wsdl">
<!-- The below classname (actually intf) is used by wsdl2java to
generate <Name>Service, and <Name>ServiceLocator classes.
It will also regenerate like-named interface, but with each
method throwing RMIExceptions... -->
<!-- The service name at the end of the url specifies the
className prefix for *SoapBinding{Impl|Stub}.java classes that are
generated -->
<axis-java2wsdl
classname="com.vxappliance.quotations.Quotations"
namespace="urn:QuotationsService"
location="http://${tomcat.host}:${tomcat.port}/axis/services/QuotationsService"
output="${build}/generated/QuotationsService.wsdl"
bindingname="Quotations" serviceportname="QuotationsService">
<classpath>
<pathelement location="${build}/classes"/>
</classpath>
</axis-java2wsdl>
</target>
<target depends="java2wsdl" description="Generate server/client
stubs, wsdd" name="wsdl2java">
<!-- Generate stubs/skeletons and deploy/undeploy wsdd -->
<axis-wsdl2java debug="true" verbose="true"
output="${build}/generated" serverside="true" skeletondeploy="true"
url="${build}/generated/QuotationsService.wsdl"
testcase="true">
<mapping namespace="urn:QuotationsService"
package="com.vxappliance.quotations"/>
</axis-wsdl2java>
</target>
