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...
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:
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.
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.
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)
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.
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?
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!
crispy bacon. crispy tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth