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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to