|
Re: Different Results for Web Service [message #149608 is a reply to message #149590] |
Tue, 29 November 2005 01:39 |
Ben Sisson Messages: 202 Registered: July 2009 |
Senior Member |
|
|
I believe that I know the answer as to why they run differently. When my
Web Service runs from Eclipse, I belive that it access the Web Service
located under Tomcat manager, Web Service name, WSDL directory (WSDL
file). However, when I startup Tomcat server from outside Eclipse I
believ that it runs the Web Service from under the Tomcat manger, AXIS
directory, servlet, Axis Servlet WSDL file.
If this is an accurate explenation then I have the following question, why
are the WSDL files distinctively different. When I run my Java client in
Eclipse the WSDL2JAVA generates simple method calls that I can deploy
easily. When I use the AXIS WSDL file it generates Web Service methods
that require a parameter list class and I often have trouble with these
classes.
I may be wrong here, I will continue to research but would appreciate any
help that I can get.
Thanks in advance,
Ben
|
|
|
Re: Different Results for Web Service [message #149717 is a reply to message #149608] |
Tue, 29 November 2005 16:16 |
Ben Sisson Messages: 202 Registered: July 2009 |
Senior Member |
|
|
This is what I can deduce from what I have found:
1) I created a Web Service project from a WSDL file in Eclipse using an
Apache Tomcat 5.0 server. Eclipse deploys certain files to the Tomcat
server. Including, two WSDL files under the Web Service name. The first
is directly under the service name and the second in a WSDL sub directory
below that. I can then generate a Web Service Client from the second
WSDL file in one of two ways, but for this example I will focus on the
WSDL2JAVA plugin, create a new Java project, copy the WSDL file into the
project, right click on it and select WSDL2JAVA. The needed files to
communicate with the Web Service are generated. I then merely add the
code to access the Web Services:
Sample code:
// Creates Service Locator object
ExerciseSupportServicesLocator locator = new
ExerciseSupportServicesLocator();
// Creates the stub
ExerciseSupportServicesSoapStub myStub = (ExerciseSupportServicesSoapStub)
locator.getExerciseSupportServicesSoap();
// Calls method with a string and returns an int value that is printed
System.out.println("\nJoin Agg Network Result: " +
myStub.joinAggNetwork("1,connect"));
I launch the Server in Eclipse and run the Java application which calls
this code and prints a valid value. The WSDL2JAVA generated 4 java files:
ExerciseSupportServices.java, ExerciseSupportServices.Soap.java,
ExerciseSupportServicesLocator.java, and
ExerciseSupportServicesSoapStub.java. This is perfect and matches the
examples I have read.
2) When I created the Web Services a deploy.wsdd (web services deploy
descriptor) file was created to deploy the services. I run this file to
deploy the services to Axis. I go to the web service URL and it verify
its existance, I then add the ?wsdl behind the URL and get a WSDL file. I
now create a new Java Project within eclipse and copy this WSDL file into
it. I peform a WSDL2JAVA on this WSDL file and I get different results
from what I got before. I still get the same 4 java files as before but I
get 2 new java files for each method in the Web Service. One file is
_"method name".java and the other _"method name"Response.java. I find
also that the method calls that I had setup before no longer work. I now
need to create a class for these new .java files and pass them as
parameters instead of the string parameters that I was passing before.
Sample code:
// Creates Service Locator object
ExerciseSupportServicesLocator locator = new
ExerciseSupportServicesLocator();
// Creates the stub
ExerciseSupportServicesSoapSoapBindingStub myStub =
(ExerciseSupportServicesSoapSoapBindingStub)
locator.getExerciseSupportServicesSoap();
_JoinAggNetwork jan = new _JoinAggNetwork();
jan.setId_psswd("1,connect");
_JoinAggNetworkResponse janr = new _JoinAggNetworkResponse();
janr.setJoinAggNetworkResult(myStub.joinAggNetwork(jan).getJ oinAggNetworkResult());
This creates a major issue: (1) Any code that I created initially in
Eclipse development would not work once the Web Service has been deployed
to Axis. This would cause major issues.
I am confused why the WSDL deployed to AXIS is not the same as the WSDL on
Tomcat. The methods are the same, everything is generated and deployed by
Eclipse. I would appreciate any help I can get on this.
Thanks,
Ben
|
|
|
|
Powered by
FUDForum. Page generated in 0.02868 seconds