Web services using Apache Tomcat and Eclipse

After working for almost a week with outdated and severely complicated yet unhelpful tutorials for web services using Eclipse (Europa), I decided to put together a simple, step-by-step, to-the-point tutorial on how to use a simple, small web service. It’s mostly a screencast with some explanations.

Read it here in PDF.

Alternative link: here.

Mirror post on: http://serg.imsciences.edu.pk

21 Comments

  1. This great..Very helpful..thanks

  2. Hi recluze,
    I got a problem when trying to create a web service .
    I’m trying to create it thru eclipse europa and it says tomcat server started.But when i tried to give the localhost url in the browser it is giving 404 error.
    If i run the start.batch file in bin folder then it is working fine.
    One more problem is when i was trying to create a web service using create web service then it is giving the following error
    Unable to add the follwing facets to project “AxisWSTestClient”: Axis2 Web Services Extensions, Axis2 Web Services Core.
    Please help me with this stuff.

  3. I can’t be sure of the problem but consider the following:

    1. Did you stop tomcat from the monitor before starting it in eclipse.

    2. When you start tomcat from within eclipse, you won’t be able to see the normal axis applications. They’re not loaded. So, the normal http://localhost will return a 404 as no app is loaded at that location.

    3. I’m not sure about the facets problem. Never faced it. Can you send me the details of the procedure you followed along along with any detailed message descriptions? I’ll see what I can find.

    A few pointers:

    1. Make sure your CLASSPATH and AXISCLASSPATH and other env vars are set properly. This is the most common problem.

    2. Make sure there’s no space in the path to your eclipes executable. This is probably a bug but gives a lot of headaches. Put eclipse somewhere like D:\eclipse\eclipse.exe

    3. The java convention of camelCase for function names and TitleCase for class names is required for Axis web services. Never read it anywhere but it gives many errors if you don’t follow these conventions.

    Hope this helps.

  4. Thanku so much for your reply.Where should i set the path to eclipse?

  5. But when i start server from eclipse then http://localhost:8080 should work right?

  6. The path to eclipse just refers to the place where eclipse executable resides. (Meaning the place you extract the eclipse archive to.)

    Localhost should work in the sense that it should display a 404 generated by tomcat instead of a “no response”. Get the web service endpoint from the Web Service Explorer as described in the tutorial.

  7. Hi recluze,
    I am getting the following error when trying to create the web service from java file.If i start the server from bat file and work on deploy.wsdd from cmd prompt it is working fine.Please help me out with this.

    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/SamplWS/services/AdminService

  8. hi. When I launch the web services explorer and try to select the wdsl source, the workspace is ok but there is no wdsl url. Please help me.
    thanks

  9. You have to click on ‘browse’ and select the proper project. Only then will you see the WSDL url.

  10. I click on browse, select the category, the workspace project, but there is no WSDL url!!! And ‘Go’ does nothing..

  11. Hmm… there might be several things that are causing this problem:

    1. Have you created the project as a “dynamic web project” ?
    2. Have you created a java file with a public function?
    3. Have you built the project (if it’s set to not build automatically)?
    4. Have you right-clicked on the java file and “create a web service”d?
    5. Were there any errors there?

    Make sure you have a WSDL file in the project outputs. If so, try creating a client (refer to the tutorial) and see if it works. If it does, there might be something wrong with your WTP in Eclipse. Gimme a little more to work with and I’ll try to help.

  12. 1. YES
    2. YES
    3. YES
    4. YES
    5. NO errors!

    It only works if I insert the WSDL url (http://localhost:8080/ConverterProj/services/Converter?wsdl) in the Web Service Explorer main page.
    The client works too!

  13. My problems now is that I can’t test server and client using the browser.
    When I enter http://localhost:8080/SOATest/services/Echo this is the result:

    The endpoint reference (EPR) for the Operation not found is /SOATest/services/Echo and the WSA Action = null

    Where is the problem??

  14. I have tried deploying this whole of the tutorial for creating web service in eclipse3.4. It creates it fine in web services explorer. It shows the status of tomcat also as started. But when it comes to running web service on a web browser it gives me 404 error. It works absolutely fine in web service browser.
    Even when I try to see tomcat home page with http://localhost:8080 it gives me error, But in ecllipse it shows me started status.

  15. Nikita: You get a 404 because the default tomcat doesn’t have the deployment descriptors etc. The details are a little innvolved and I’m not very sure about them either. 🙂

    What you need to do is search on “deployment descriptors” — this is basic tomcat stuff. You can find them in many tutorials. Eclipse generates them automatically but you’ll have to explore the automatically generated files to find them. If you find some precise method of performing this step, please do let me know too.

    I can give you a starting point: http://www.developer.com/services/article.php/10928_3557741_3 … says you can create an archive and drop it in your axis services folder. Let me know how it goes.

  16. AoA.

    Any hints to do this on Ubuntu? Or just change in commands due to different platform?

  17. It’s truly a nice and helpful piece of info. I am satisfied that you shared this useful information with us. Please keep us up to date like this. Thank you for sharing.

  18. Thanks for the marvelous posting! I seriously enjoyed
    reading it, you may be a great author. I will ensure that I bookmark your blog
    and definitely will come back sometime soon. I want to
    encourage continue your great job, have a nice afternoon!

Leave a Reply

Your email address will not be published.

*

© 2017 recluze

Theme by Anders NorénUp ↑