Quick and Easy POJO Web Services with JBossWS
Here is a step-by-step tutorial explaining the quickest and easiest way to expose a plain old java object (POJO) as a web service. This example uses jboss’s new web services stack (JBossWS-1.0.2.GA). With this method you can quickly convert any java object into a web service. For example, you could expose data access objects to a front-side client such as flex.  Best of all, no coding and extremely little configuration is needed to make the conversion from POJO to web service!
 Here is what you need:
1. at least jboss-4.0.4GA
2. with EJB3 enabled (support for annotations)
3. and includes jbossws.sar
Here is the POJO:
package com.squidpower.webservice;
public class ExampleWebService {
      public String echo(String input) {
         return input;
      }}
How to modify the POJO to be a Web Service:
import javax.jws.WebMethod;
import javax.jws.WebService;
…
@WebService
public class ExampleWebService {
…
@WebMethod
public String echo(String input) {
…
How to deploy the Web Service (lines needed in web.xml file):
Â
   ExampleWebServiceÂ
   com.squidpower.webservice.ExampleWebServiceÂ
 Â
Â
   ExampleWebServiceÂ
   /ExampleWebService/*
Â
How to access the wsdl:
http://{servername}/{webapp-context-path}/ExampleWebService?wsdl
Notes:
1. To consume the web service the client will need the uri to the wsdl
2. The return type of a web method can be
 a. any primitive type (String, int, etc.)
 b. a java bean containg primitive types with getters or as public fields
 c. arrays of these
3. Limitation: The following types are ignored and will need to be converted to arrays
 a. Collections
 b. Maps
08.09.06
by Steve Gudmundson