Tuesday, August 19, 2014

JAX-WS EJB Endpoint

EJB3.0 specification has made writing web services much easier. You do not even need a web application to host the service. The web services can be hosted in EJB container in an easy way. To write the web service write a Stateless EJB and mark it as Web service


public class ProductPriceBean {

private Map productMap = new HashMap();

public double getPrice(String symbol){
   String price = (String) productMap.get(symbol);
        if(price != null){
            return Double.parseDouble(price);
   return -1;

Note that you donot have to write any interface like Local or Remote. Just write this, deploy it as a Jar in your EJB container and hit the ((WSDL)) at:


More on Web services

No comments:

Post a Comment