web-servicesmaven-2installationapache-axisaxis2c

Understanding of usage of Java2Wsdl for axis2/c


I have a problem with the installation of Java2Wsdl tool.

I have succesfully created and compiled(generated the .class file from the .java file) a simple Java class inside a directory /home/user/examples/com/mycompany/app. In there I compile my SimpleClass and so, I have two files: SimpleClass.java & a SimpleClass.class .

Next, I have axis2/c installed on my ubuntu system

$ echo $AXIS2C_HOME
/usr/local/axis2c

I also have axis2/java installed

echo $AXIS2_HOME
/opt/axis2-1.6.2

I also downloaded, extracted and installed from this link the java2wsdl plugin.

This is how the bin directory looks like. username@usernamePC:/opt/axis2-1.6.2/bin$ ls
axis2.bat axis2server.sh java2wsdl.bat setenv.sh wsdl2java.sh axis2server.bat axis2.sh java2wsdl.sh wsdl2java.bat

Now, I want to convert my initial project from java to wsdl with java2wsdl but I cannot understand the right place of directory I should put that into, if I have the classpath(?) right and what would be the correct command for the conversion to happen.

I am trying something like that:
Java2WSDL.sh -cn com.mycompany.app.SimpleClass In here I put . instead of / and I am typing that in top directory, meaning com directory.

Can you help me out with this? I am sorry for the long question but I needed to set all things right.

my-app was build with a simple maven project (maven 2.2.1) through this guide.


Solution

  • You should start codegeneration from build/classes directory. That directory must have com and META-INF subdirs.

    Example of generating WSDL:

    # compile your project using ant or mvn
    ant
    # go to binary dir
    cd build/classes
    # check SimpleClass.class is here
    ls com/mycompany/app/SimpleClass.class
    # generate WSDL into current directory
    $AXIS2_HOME/bin/java2wsdl.sh -cn com.mycompany.app.SimpleClass
    # see generated WSDL
    cat SimpleClass.wsdl
    

    To generate WSDL into different directory append -o <directory> switch to command line of wsdl2java.sh script.