You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by david2 <Da...@l-3comcept.com> on 2007/03/28 19:12:01 UTC

Ant wsdl2java & command line WSDL2Java generate different code

I have been working with the Axis2UserGuide.wsdl example to find a suitable
way to automate our Axis2 web service builds from ant.

I successfully generated the client using the batch file
(%AXIS2_HOME%\bin\wsdl2java...).  I have also successfully generated the
service from the java class (java org.apache.axis2.wsdl.WSDL2Java...).

When I tried to perform the same exercise using Ant wsdl2java tasks (as per
sample quickstartadb), code was generated, however, when I deployed the aar
file, it did not respond to the Client.  The DoInOnly message was not
received by the service (I added print statements to the appropriate
Axis2UserGuideServiceSkeleton methods to verify this).  Furthermore, the
other messages all generated AxisFaults when the execute(true) method is
sent to the _operationClient (OutInAxisOperation).  I redeployed the
original aar file generated by Java command line, restarted Tomcat, and the
Client worked fine.

I also noticed that the ant wsdl2java task generated an
Axis2UserGuideServiceSkeletonInterface class which was never generated by
the invocation of WSDL2Java as a Java class.  Also, when I compared the
generated message receiver service code side by side, I noticed that the
versions of Axis2UserGuideServiceMessageReceiverInOnly.java &
Axis2UserGuideServiceMessageReceiverInOut.java generated by the Ant
wsdl2java task reference the skeleton Interface:

        Axis2UserGuideServiceSkeletonInterface skel =
(Axis2UserGuideServiceSkeletonInterface)obj;

whereas the those generated via the Java command line reference the Skeleton
class itself:

        Axis2UserGuideServiceSkeleton skel =
(Axis2UserGuideServiceSkeleton)obj;

My questions are:


1)  Why would the ant task generate different code than the Java command
line approach?

2)  What are the impacts of using the command line generated classes that
reference the Skeleton, rather than the Interface?

3)  Is there a better way to automate the Ant build?


I am using the Axis2UserGuide.wsdl defined in the user's guide, and separate
directories for client and source code.  Here is how I am generating the
code:

Command line client code generation (all on one line):
======================================================

	%AXIS2_HOME%\bin\wsdl2java 
		-uri Axis2UserGuide.wsdl 
		-p org.apache.axis2.axis2userguide 
		-o client 
		-d adb 
		-s

Ant task client code generation (all on one line):
==================================================

        <taskdef name="wsdl2java"
                 classname="org.apache.axis2.tool.ant.AntCodegenTask"
                 classpathref="axis2.classpath"/>
        <wsdl2java wsdlFilename="${wsdl.file}"
                   output="${client.dir}"
                   packageName="org.apache.axis2.axis2userguide"
                   language="java"
                   databindingName="adb"
                   synconly="true"
                  
namespaceToPackages="http://apache.org/axis2/Axis2UserGuide=org.apache.axis2.axis2userguide"
        />

Command line service code generation (all on one line):
=======================================================

	java org.apache.axis2.wsdl.WSDL2Java 
		-uri Axis2UserGuide.wsdl 
		-p org.apache.axis2.axis2userguide 
		-o service 
		-d adb 
		-s 
		-wv 1.1 
		-ss 
		-sd

Ant task service code generation (all on one line):
===================================================

        <taskdef name="wsdl2java"
                 classname="org.apache.axis2.tool.ant.AntCodegenTask"
                 classpathref="axis2.classpath"/>
        <wsdl2java wsdlFilename="${wsdl.file}"
                   output="${service.dir}"
                   packageName="org.apache.axis2.axis2userguide"
                   language="java"
                   databindingName="adb"
                   synconly="true"
                   serverside="true"
                   serverSideInterface="true"
                  
namespaceToPackages="http://apache.org/axis2/Axis2UserGuide=org.apache.axis2.axis2userguide"
                   generateservicexml="true"
        />

Client output, including AxisFault stack traces:
================================
doInOnly done

org.apache.axis2.AxisFault:
org.apache.axis2.axis2userguide.Axis2UserGuideServiceSkeleton
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
	at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
	at
org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.TwoWayOneParameterEcho(Axis2UserGuideServiceStub.java:277)
	at
org.apache.axis2.axis2userguide.Client.twoWayOneParameterEcho(Client.java:54)
	at org.apache.axis2.axis2userguide.Client.main(Client.java:19)

org.apache.axis2.AxisFault:
org.apache.axis2.axis2userguide.Axis2UserGuideServiceSkeleton
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
	at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
	at
org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.NoParameters(Axis2UserGuideServiceStub.java:174)
	at org.apache.axis2.axis2userguide.Client.noParameters(Client.java:69)
	at org.apache.axis2.axis2userguide.Client.main(Client.java:20)

org.apache.axis2.AxisFault:
org.apache.axis2.axis2userguide.Axis2UserGuideServiceSkeleton
	at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:271)
	at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
	at
org.apache.axis2.axis2userguide.Axis2UserGuideServiceStub.MultipleParametersAddItem(Axis2UserGuideServiceStub.java:421)
	at
org.apache.axis2.axis2userguide.Client.multipleParameters(Client.java:90)
	at org.apache.axis2.axis2userguide.Client.main(Client.java:21)

-- 
View this message in context: http://www.nabble.com/Ant-wsdl2java---command-line-WSDL2Java-generate-different-code-tf3481674.html#a9718208
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: Ant wsdl2java & command line WSDL2Java generate different code

Posted by Glen Mazza <gr...@verizon.net>.
Am Mittwoch, den 28.03.2007, 10:12 -0700 schrieb david2:

> I also noticed that the ant wsdl2java task generated an
> Axis2UserGuideServiceSkeletonInterface class which was never generated by
> the invocation of WSDL2Java as a Java class. 

According to the docs[1], it appears that that's because you did not set
the -ssi option for the CLI, or equivalently because you set the
"serverSideInterface" option with the Ant task.

Glen


[1] http://ws.apache.org/axis2/tools/1_1/CodegenToolReference.html

> 
> Command line service code generation (all on one line):
> =======================================================
> 
> 	java org.apache.axis2.wsdl.WSDL2Java 
> 		-uri Axis2UserGuide.wsdl 
> 		-p org.apache.axis2.axis2userguide 
> 		-o service 
> 		-d adb 
> 		-s 
> 		-wv 1.1 
> 		-ss 
> 		-sd
> 
> Ant task service code generation (all on one line):
> ===================================================
> 
>         <taskdef name="wsdl2java"
>                  classname="org.apache.axis2.tool.ant.AntCodegenTask"
>                  classpathref="axis2.classpath"/>
>         <wsdl2java wsdlFilename="${wsdl.file}"
>                    output="${service.dir}"
>                    packageName="org.apache.axis2.axis2userguide"
>                    language="java"
>                    databindingName="adb"
>                    synconly="true"
>                    serverside="true"
>                    serverSideInterface="true"
>                   
> namespaceToPackages="http://apache.org/axis2/Axis2UserGuide=org.apache.axis2.axis2userguide"
>                    generateservicexml="true"
>         />
> 



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


RE: Ant wsdl2java & command line WSDL2Java generate different code

Posted by "Masin, Valerie" <VJ...@docharbor.com>.
FYI: You can get the skeleton interfaces with the command line wsdl2java
using the -ssi flag. The default is off. 

-----Original Message-----
From: david2 [mailto:David.Bueche@l-3comcept.com] 
Sent: Wednesday, March 28, 2007 3:32 PM
To: axis-user@ws.apache.org
Subject: Re: Ant wsdl2java & command line WSDL2Java generate different
code


Answer to my question #3:  Use the Ant java task.  This behaves the same
way as the User Guide example (no Skeleton Interface, nor references to
it) and, best of all, the Client successfully executes against the
resulting aar.

Here are the tasks for generating the service aar file.  Note the copied
Skeleton containing method logic.  The ant task kicks off the build
script created by wsdl2java:

	<java classname="org.apache.axis2.wsdl.WSDL2Java">
	    <arg line="-uri ${wsdl.file} -p ${package.name} -o
${service.dir} -d ${binding} -s -wv 1.1 -ss -sd" />
	    <classpath refid="axis2.classpath" />
	</java>
	<copy file="${basedir}/Axis2UserGuideServiceSkeleton.java" 
	    toDir="${service.dir}/src/org/apache/axis2/axis2userguide/"
overwrite="yes">
	</copy>
	<ant dir="${service.dir}" />

Here are the tasks for generating the client jar file.  The ant task
kicks off the build script created by wsdl2java:

	<java classname="org.apache.axis2.wsdl.WSDL2Java">
	    <arg line="-uri ${wsdl.file} -p ${package.name} -o
${client.dir} -d ${binding} -s" />
	    <classpath refid="axis2.classpath" />
	</java>
	<ant dir="${client.dir}" />
--
View this message in context:
http://www.nabble.com/Ant-wsdl2java---command-line-WSDL2Java-generate-di
fferent-code-tf3481674.html#a9718427
Sent from the Axis - User mailing list archive at Nabble.com.


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


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


Re: Ant wsdl2java & command line WSDL2Java generate different code

Posted by david2 <Da...@l-3comcept.com>.
Answer to my question #3:  Use the Ant java task.  This behaves the same way
as the User Guide example (no Skeleton Interface, nor references to it) and,
best of all, the Client successfully executes against the resulting aar.

Here are the tasks for generating the service aar file.  Note the copied
Skeleton containing method logic.  The ant task kicks off the build script
created by wsdl2java:

	<java classname="org.apache.axis2.wsdl.WSDL2Java">
	    <arg line="-uri ${wsdl.file} -p ${package.name} -o ${service.dir} -d
${binding} -s -wv 1.1 -ss -sd" />
	    <classpath refid="axis2.classpath" />
	</java>
	<copy file="${basedir}/Axis2UserGuideServiceSkeleton.java" 
	    toDir="${service.dir}/src/org/apache/axis2/axis2userguide/"
overwrite="yes">
	</copy>
	<ant dir="${service.dir}" />

Here are the tasks for generating the client jar file.  The ant task kicks
off the build script created by wsdl2java:

	<java classname="org.apache.axis2.wsdl.WSDL2Java">
	    <arg line="-uri ${wsdl.file} -p ${package.name} -o ${client.dir} -d
${binding} -s" />
	    <classpath refid="axis2.classpath" />
	</java>
	<ant dir="${client.dir}" />
-- 
View this message in context: http://www.nabble.com/Ant-wsdl2java---command-line-WSDL2Java-generate-different-code-tf3481674.html#a9718427
Sent from the Axis - User mailing list archive at Nabble.com.


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