Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Different Results for Web Service
Different Results for Web Service [message #149590] Mon, 28 November 2005 23:22 Go to next message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
I am running Tomcat 5.0 and Eclipse 3.1.1. I created a Java project Web
client using the WSDL2JAVA plugin. I start the Tomcat server in Eclipse
that contains my Web Service and run my new Java Client project and I get
the expected results. I stop the Tomcat server from Eclipse.

Then I start the Tomcat server from the Tomcat directory (outside of
Eclipse) and run the same Java Project client that I created. This time I
get an error message though: java.lang.reflect.InvocationTargetException

My understanding was that Eclipse deployed the Web Services and therefore
I should be able to run them outside of Eclipse. Again, I'm running the
client from within Eclipse, the only difference is that I started the
Tomcat server (where the Web Service is deployed) outside Eclipse.

Some of my Server options that I have set in Eclipse: Under publish I
have the "Use default publishing settings" checked. Under the server
options I do not have any of the boxes checked.

On the modules tab I do see something that I can't explain, it may be
correct I just don't understand it. For path, document base, and auto
reload information is filled in. However, the Module column does not have
any information filled in. I don't know if this has an impact or is
causing the problem. Also, what causes this column to be filled in and
not to be filled in?

I would appreciate any help that I can get.

Thanks in advance,
Ben
Re: Different Results for Web Service [message #149608 is a reply to message #149590] Tue, 29 November 2005 01:39 Go to previous messageGo to next message
Ben Sisson is currently offline Ben SissonFriend
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 Go to previous messageGo to next message
Ben Sisson is currently offline Ben SissonFriend
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
Re: Different Results for Web Service [message #149801 is a reply to message #149717] Tue, 29 November 2005 19:48 Go to previous message
Ben Sisson is currently offline Ben SissonFriend
Messages: 202
Registered: July 2009
Senior Member
I don't have any answer as to why the WSDL in AXIS is different that the
one in Tomcat after runing the deploy.wsdd and why they generate the same
methods but with different parameters but I do have a work around.

Take the Tomcat WSDL, located under the .../project name/wsdl directory
within the Tomcat manger. Use this WSDL file to generate the Java Web
Service client (WSDL2JAVA). This should produce 4 .java programs. In the
{Project Name}Locator.java code will be a line that contains the {Project
Name}Soap_address, something like this

// 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";

After you do this you should be able to startup the Server from outside of
Eclipse and run your projects. This was the only way that I could find to
deploy the service and run it outside of Eclipse.

If someone can explain the differences between the WSDLs and a better way
of doing this I would greatly appreciate it but until then this works. I
hope this helps others.

Thanks,
Ben
Previous Topic:Does Web Services Explorer support WS-Policy and WS-Security?
Next Topic:is jsp validation broken in m9
Goto Forum:
  


Current Time: Fri Apr 26 17:21:38 GMT 2024

Powered by FUDForum. Page generated in 0.03767 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top