Just putting in my 2 cents, because a week ago I knew nothing about Axis, and
I had to overcome some of the hurdles that have been encountered by other
posters in the past... I hope I can avoid other people the same wasted time
that I experienced...
My environment is Eclipse 3.2.2, with the Codegen Wizard plugin.
I have used the wizard in both directions (wsdl2java and java2wsdl) in
versions 1.3 and 1.4.1 of Axis2.
About the wizard : when you go to the Axis website, you can download the
Codegen Wizard plugin for any version of Axis. What's misleading is that
when you unzip each version (1.3 and 1.4.1), they both are contained in the
"Axis2_Codegen_Wizard_1.3.0" directory. Having successfully created my
stubs with version 1.3 of the wizard and Axis libraries, I now wanted to
compile them with Axis2 1.4.1. My first reaction when I downloaded the
1.4.1 wizard was to say "hmmm... seems the wizard hasn't changed since
version 1.3, because it's in the same directory name". WRONG ! Upon
further inspection, I clearly saw that the libraries in the /lib directory
of the plugin were indeed different.
So, here are the steps I would recommend for a successful compile :
- If you're in Eclipse, EXIT !
- If you have not done so yet, download the Axis2 standard distribution
binary for the version you want, unzip it to some directory, and then create
an environment variable "AXIS2_HOME" that points to that directory.
- Download the Codegen Wizard for the Axis version you're shooting for (the
same version as the standard distribution). Unzip it into your Eclipse's
plugins directory. Note that if you had a previous version of the plugin
there, you're gonna have to overwrite it with this new one if they both have
the same name.
- Copy the geronimo-stax-api_1.0_spec-1.0.1.jar and
backport-util-concurrent-3.1.jar from the AXIS2_HOME/lib directory to the
Wizard's /lib directory.
- Edit the plugin.xml file of the Wizard. You'll see in there a bunch of
nodes, add 2 nodes pointing to the jars you just copied.
- Start Eclipse
- Create a new project
- In that project, import the jars from the AXIS2_HOME/lib directory (import
them in a new folder you'll call lib)
- Refresh the project
- Project properties : Add all the jars to the build path
- Create some java class that will have the methods you want your web
service to have. Save it.
- Right-click on the project, New->, Other...
- Select Axis2 Wizards -> Axis2 Code Generator, Next.
- Select Java2WSDL
- Type the fully qualified class name, and then add the path for the class
file. For example, if you class is com.xyz.TheClass, and your java source
is in /src/com/xyz/TheClass.java, and the corresponding class file
is in /bin/com/xyz/TheClass.class, then you'd enter "/bin.
- Click Test Class Loading... If it doesn't work, review previous step.
- Click Next, and you can change the options if you want, and then click
next again.
- Select to send the output to a project in the workspace, and browse to
that project. Then give your wsdl a name, and click Finish.
- Hopefully, all went well, and if you refresh your project, you'll see the
WSDL.
Now, if you want to create client and server code for this new WSDL:
- Go in the codegen wizard again, this time select WSDL2Java, click Next.
- Select the WSDL file you've just created. Next.
- In Codegen Option, select Custom. Check "Generate both..." (last
checkbox). Next.
- Browse to the project location, and Click Finish.
You should have the client and server code generated, along with a nice ant
build file.
The class you'll want to modify is Skeleton.java for the
server-side. For a client to use that service, you'd instantiate
Stub.java.
I really hope this helps someone in the future. It's been a frustrating
week.
Jacques.
--
View this message in context:
http://www.nabble.com/WSDL2JAVA-created-uncompilable-Stub-tp17775033p22872262.html
Sent from the Axis - User mailing list archive at Nabble.com.