views:

63

answers:

2

As a web services beginner, I have tried for 2 weeks to get a hello world webservice working with maven, eclipse and tomcat.

I gave up trying to get any of the code/wsdl generators to work, and I followed this tutorial http://myarch.com/create-jax-ws-service-in-5-minutes to hand code an example, which is brilliant.

This results in 4 class files and a WSDL file.

So my stupid question is how to "run" the service in eclipse and/or on tomcat?

I tried just deploying them as a webapp, but no joy - there is nothing in the web.xml to tell the servlet engine that the web service exists, so I guess it could never work.

Do I have to have a special web service container (e.g. axis2, metro or CXF) inside tomcat, and deploy to that? Or can it just run with some jax-ws jars + mystery configuration?

I dont want to have to install into tomcat metro (which uses ant, and is desiged for glassfish), or axis2 (which uses ant, and most people seem to not recommend).

I looked at CXF, but cant find anywhere on their site on how to install/configure it on tomcat (or eclipse) without spring. I put the CFX jars in maven dependencies, and installed the eclipse plugin, but this deoesnt get you any closer to actually running a webservice with out the mystery configuration glue. CXF seems tied to spring, which is a big minus for us as we dont use spring (or need any of its features).

I noticed helios wtp has some kind of web service project called JSR-109. Is this java RPC only, or does it support the full SOAP websiervice system, and is it worth trying to figrue out?

Any advice very welcome. I must have googled 1000 pages in search of the web serive holy grail - i.e. how to create and deploy one to tomcat end to end. Is it supposed to be this hard?

A: 

I know it's a cliche but it sounds like you are trying to reinvent the wheel. There's a reason there are things like Axis2 and CXF. They do a lot of the hard work for you. I've used both and had a lot of success with them. Keep in mind I'm speaking from limited personal experience.

I've found that CXF and Spring make it very easy to set up a contract-first JAX-WS service and even add WS-Security, message logging, schema validation and HTTP configuration settings. Mostly done with the Spring XML config file. I've also learned that Spring can be used with Quartz to schedule jobs and manage your data access as well. It's a pretty handy tool.

Axis2, while I haven't used it in a while, I remember it making it pretty easy to turn some POJOs into a service with minimal effort.

My only experience with Metro is a little test service I created with NetBeans and ran it on the built-in Glassfish server. It was very easy, but the IDE did a lot of the work for you, which probably isn't a good way to learn. It felt like it just took a bunch of mouse clicks and all of a sudden there was a service.

Also this question is kind of related.

Good luck!

sisslack
A: 

Take a look at http://www.jroller.com/gmazza/entry/web_service_tutorial. It is a complete step by step guide for CXF and metro. Tomcat is used for deployment and there are also maven and ant versions in case you prefer one to another option for organizing project builds.

draganstankovic