• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Facing Problems Running My First WebService

 
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

I am learning WebService. I am using Axis 1.5.1, Eclipse and Tomcat 6.0.29. I am referring to the tutorial:
http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html

After creating the host, when run the project on Tomcat, i get this error:




And my browser shows:



I read somewhere that it is a common problem with Eclipse. Is it true? Please help.
 
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Host means Web Service?

How are you creating Web Service?
If you are using Eclipse, you can just right click on the file, which you wanted to expose as Web Service, and say create webservice.
It asks for the options, create, deploy test etc.

If you select test, the Webservice will be deployed on the Tomcat and a web page opens with your webservice methods...

Hope that helps!
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting this error after i do the step 17 (on the tutorial link), when the server actually starts. I am doing the same thing as you mentioned, but somehow its not working.
 
Prabhakar Reddy Bokka
Ranch Hand
Posts: 198
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try changing options in step 12.

Options on the left side vertcal bar
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am selecting the correct options for them as well, at least the

are gone now after I changed the Axis2 from 1.5.1 to 1.4.1.

But still I am not able to run the application. All i get is this:



Please help me out with this...

 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. Please try this with Axis2 1.4 instead of 1.5.1. The Eclipse tooling is supported only for 1.4.1. Let us know if you still get the error.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error is gone with 1.4.1... But still the application wont run. I get the error:

which i already mentioned.
 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Somnath. My apologies. I had not checked your earlier post. Yes, it can be a pain to get this running, no matter how many times you have done it before. Anyway, I used Tomcat 6.0.26 (instead of 5.5 as mentioned in the tutorial) and Axis2 1.4.1.

For your reference, this is my project's WebContent directory structure (after following the tutorial) as seen in Eclipse:

MeraFirst
--WebContent
----axis2-web
------css directory
------Error directory
------images directory
------include directory
------lots of jsp files
------index.jsp
------more jsp files
----META-INF
----WEB-INF
----wsdl

To get this to work, I did the following:

1. Right-click index.jsp
2. Select Run As-->Run on Server
3. Select the configured tomcat server

And it took me to http://localhost:8080/MeraFirst/axis2-web/index.jsp which worked And I get the same 404 error as you do when I go to http://localhost:8080/MeraFirst/ So the tutorial is probably old and not updated for newer releases of Axis2.

You can also browse the WSDL of the Converter service you created by going to http://localhost:8080/MeraFirst/services/Converter?wsdl

And then you can download and install the open source version of SOAP UI. And play with that as well. You can use SOAP UI to generate SOAP requests from a WSDL URL (like the one above), send those requests to the Web Service Endpoint, and then show the SOAP response.

Hope that helps.
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Srini for the help. How did you know that that the URL would be different??? I guess there's no replacement for experience.

But now... In steps 26 and 27 of the tutorial you can see that there are a lot of stub files that are being generated on the Client. Now when I create my client I only have 2 classes and no stubs! And the example shown, is also written using the stubs! Now how come mine doesn't generate any stubs???

I am attaching my directory structure. Please take a look at it.
1.JPG
[Thumbnail for 1.JPG]
Eclipse Directory Structure
 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Comparing notes:
Step 21: Use http://localhost:8080/MeraFirst/services/Converter?wsdl
Step 22: Make sure that Axis2 is selected before proceeding to next step. In my case, Axis was selected by default, and I had to explicitly select Axis2.
Step 24: I clicked on Client Project MeraFirst, overwrote it to MeraFirstClient, and the Client Project Type was "Dynamic Web", i.e. web application
Step 25: My default values were different that in the tutorial, probably due to the newer version of Eclipse or some plug-in:
Service Name: ConverterService (the one for which we are generating a client)
Port Name: Converter (instead of ConverterSOAP11port_http in the tutorial)
Databinding: ADB

Now, my results match yours:
a) a CallbackHandler file
b) a Stub file
c) axis2-web under WebContent, just like in the MeraFirst web service project

Now how come mine doesn't generate any stubs???


It does. As I am sure you know, WorkerStub.java is your generated stub file.

Step 27: And finally, the following client program worked for me:


So: the answer to your question is simple. The wtp (or whatever tool (like WSDL2Java) that generated the code internally) was from an older version that was current at the time the tutorial was written. Now, only two source files are generated. This is expected and ok.

All the best!
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Srini for the code... But by looking at your code I have a few questions. First of all:
I have two generated methods:
ConverterStub and ConverterCallbackHandler. But in the code you have given you have used some other classes as well, like ConverterServiceStub, Celsius2Fahrenheit and Celsius2FahrenheitResponse. Were these classes also coded by you?
 
Somnath Mallick
Ranch Hand
Posts: 483
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would be better if you could provide a link which has tutorial with the latest web services updates!
 
R Srini
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you look at the code, Celsius2Fahrenheit is wtp.ConverterServiceStub.Celsius2Fahrenheit. It is generated and located in the stub file. Here is a tutorial using Netbeans. There are tons of other tutorials on the web. Please search for tutorials for your particular combination of tools.

There is a certain amount of experimentation, and a learning curve involved in this. A few tutorials won't get you very far. Please look for a good book. The book Developing Web Services with Apache Axis2 is one I have heard good things about. All the best!
 
reply
    Bookmark Topic Watch Topic
  • New Topic