Writing a web service in 5 minutes with SIwpas! How? Below...
SIwpas uses OpenEJB integration for Web service support, and amazing thing is that you can deploy your EJBs as a WAR archive. Lets start...
1. Create a new Web modules with Eclipse,
2. Code as follows
Web Service Interface
@Local
@WebService(targetNamespace="http://siwpas.webservice/calculator")
public interface ICalculator
{
public int add(int x, int y);
}
Web Service Implementation
@Stateless
@WebService(endpointInterface="siwpas.webservice.ICalculator",portName="CalculatorWsPort",
serviceName="CalculatorWs",targetNamespace="http://siwpas.webservice/calculator")
public class CalculatorWs implements ICalculator
{
@WebMethod
@TransactionAttribute(TransactionAttributeType.SUPPORTS)
@Override
public int add(int x, int y)
{
return x+y;
}
}
That is it! Deploy it int the SIwpas! Your web service is ready to use at
http://localhost:4204/CalculatorWs?wsdl
It is easy, hah!
Download and use SIwpas, http://code.google.com/p/siwpas/
Web Service Example :
http://code.google.com/p/siwpas/source/browse/#svn/trunk/samples/siwpas-webservice
Enjoy!
Subscribe to:
Post Comments (Atom)

No comments:
Post a Comment