I am having trouble
following one of the WSDL2JAVA examples in the User Guide. First, a little background,
I developed a Web Service from a WSDL using Eclipse and have no problem running
the Web Service out of Eclipse. I used the generated deployment descriptor to
deploy the Web Service to Axis. I log onto my Apache Tomcat server, select
the Axis path and then view to see that my Web Service has been deployed. I
can also click on the WSDL link to see the WSDL. Within Eclipse I can take the
WSDL file under the Apache Tomcat service name /WSDL directory and generate a
working Java Client (this is not the same as the WSDL file under the Axis
path). The issue that I have, when
I take the WSDL file that is under the Axis project path (per the instructions)
and use the WSDL2JAVA to generate my source files I get unexpected results. It
creates the 4 java files that I would expect: {WSDL NAME}.java, {WSDL
NAME}Locator.java, {WSDL NAME}Soap.java, and {WSDL NAME}SoapStub.java. But, it
also creates additional java files, it create two additional files for each
method that exists in the Web Service. The files are proceeded by an _. Ex:
_{METHOD NAME}.java, _{METHOD NAME}Response.java. In addition to the extra
java files, the methods in the 4 expected java files require these classes as
their input and output parameters instead of the data types that were specified in the WSDL.
This is very difficult to work with and unexpected based upon the examples that
were given in the user manual and from what I have seen elsewhere. I have found a work around
to make it perform as I would expect (per the manual). In stead of using the
WSDL file that was deployed to the Axis path for the Web Service, I use the
WSDL file that is under the Tomcat Manager\Web Service Name\WSDL directory.
This WSDL file generates the 4 java files as expected with the appropriate data
types as described in the WSDL for input and output parameters. I then modify
the {WSDL NAME}Locator.java file Soap_address line. Similar to below: // Use to get a proxy class
for {Project Name}Soap private final
java.lang.String {Project Name}Soap_address = "http://localhost:8080/WebServicesMod/services/{Project
Name}Soap"; Change it to be like this,
where you replace the WebServiceMod path with the AXIS path. // Use to get a proxy class
for {Project Name}Soap private final
java.lang.String {Project Name}Soap_address = "http://localhost:8080/axis/services/{Project
Name}Soap"; This will make the client
call the deployed Axis service and not the Tomcat service I have found. I have
not seen any issues with doing it this way. Some thoughts that I have
regarding this issue: 1) Why is the deployed Axis
WSDL slightly different than the WSDL under the Web Service\WSDL directory in
Tomcat? So that it generates the extra .java files and the class parameters
variables instead of data type variables. 2) Is there a way to make
the two WSDL files the same? 3) Where does the Deploy
descriptor pull the Web Service from when it is deployed and how does it create
the WSDL in Axis? Is it copied or build from the service? I would appreciate any help
that I can get on this. I have a work around but would prefer to have an
understanding of what is going on. Thanks in advance, Ben |