Reputation: 5167
I am trying to learn how to build web services. I am trying to do the most simple straight forward service and after all day of wasting my time I pretty much don't know what to do any more.
I Have Eclipse Indigo (32bit) with Tomcat 6.0 properly installed. In the server tab I can run/stop server as I wish. I also installed Axis2 1.6.0 engine.
Here are my steps:
1) New Web Dynamic Project
2) When done, click Project Properties > Project Facets and check Axis2 Web Services
3) Eclipse would add all bunch of files to my project. It all seems all right.
4) I would add simple Convert.java file into Java Resources/src (that would be my web service)
package wtp;
public class Convert {
public float celsiusToFarenheit ( float celsius )
{
return (celsius * 9 / 5) + 32;
}
public float farenheitToCelsius ( float farenheit )
{
return (farenheit - 32) * 5 / 9;
}
}
5) Right click on Convert.java file > Web Services > Create Web Service.
I would pick Start Service on the slider on top and click NEXT
6) Next Window would present me with my two methods celsiusToFarenheit and farenheitToCelsius. They are both checked. I would click NEXT
7) Message will show that it's trying to publish service to Tomcat and an error would show up:
IWAB0489E Error when deploying Web service to Axis runtime
axis-admin failed with {http://schemas.xmlsoap.org/soap/envelope/}Client The service cannot be found for the endpoint reference (EPR) http://localhost:8080/MyService/services/AdminService
My questions:
1) How can I solve this? What am I doing wrong? Or is it possible to do anything wrong in these few steps? Tried to look for help on Axis2 website and couldn't find anything useful there.
2) What is actually happening when I click to create New Service?
3) I come from .NET world where you write method, declare it as a web service, and upload file on the server..... and you are done. Is it possible to publish web service like that in Java? I really really hate using any type of wizards in Eclipse because most of the time they don't work. Always something missing and I end up loosing hours Googling....
Thanks,
Any help is appreciated.
Upvotes: 2
Views: 8204
Reputation: 362
To clarify a bit more what Prince Bhanwra has written, what you must do is: - Select your java file - Right click and select New / Other / Web Service and click Next - On the next page, take a look at the Configuration. Be sure you are using Apache Axis2. On my case I had the same error and it shows Web service runtime: Apache Axis. You only have to click over it to select Axis2.
On this page you'll have it with screens and more information on how you have to create your client to test it. http://www.eclipse.org/webtools/community/tutorials/BottomUpAxis2WebService/bu_tutorial.html
Upvotes: 0
Reputation: 192
It is because on the previous page value(default) of Web service runtime" to Apache Axis.
Click on "Back" button change the option to "Apache Axis2" and you are good to go.
Upvotes: 2
Reputation: 3088
Here is the Solution.
To fix this, I had to change the server runtime to Axis2 (Eclipse should warn you about this when you add the Axis2 facet, but it doesn't). Do this by going to the Window menu, select Preferences > Web Services > Server and Runtime. Choose your server (Tomcat 5.5 in my case), then select Apache Axis2 as the web service runtime.
You can find the solution here http://www.psuedoguru.com/roller/page/psuedoblog?entry=problems_with_wsdl_first_web
Upvotes: 8