Here is my sample of accessing SOAP message body content - Cabin by EJB exposed 
as a web service

  | package com.bruno.net.ejb;
  | 
  | import javax.annotation.PostConstruct;
  | import javax.ejb.Stateless;
  | import javax.jws.Oneway;
  | import javax.jws.WebMethod;
  | import javax.jws.WebParam;
  | import javax.jws.WebResult;
  | import javax.jws.WebService;
  | import javax.persistence.EntityManager;
  | import javax.persistence.PersistenceContext;
  | import javax.xml.ws.WebServiceRef;
  | 
  | import org.apache.log4j.Logger;
  | 
  | import com.bruno.net.domain.Cabin;
  | 
  | @WebService(name = "TravelAgent", serviceName = "TravelAgentService")
  | @WebServiceRef(name = "service/TravelAgentService")
  | @Stateless
  | public class TravelAgentBean implements TravelAgentRemote {
  |     private Logger logger;
  | 
  |     @PersistenceContext(unitName = "titan")
  |     private EntityManager manager;
  | 
  |     @PostConstruct
  |     public void postConstruct() {
  |             logger = Logger.getLogger(getClass().getName());
  |     }
  | 
  |     @WebMethod
  |     @Oneway
  |     public void createCabin(@WebParam(name = "Cabin")
  |     Cabin cabin) {
  |             logger.debug("here is my cabin delivered by JAX-WS = " + cabin);
  |             logger.debug("cabin name " + cabin.getName());
  |             logger.debug("bed count " + cabin.getBedCount());
  |             manager.persist(cabin);
  |     }
  | 
  |     @WebMethod
  |     @WebResult(name = "Cabin")
  |     public Cabin findCabin(@WebParam(name = "ID")
  |     int pKey) {
  |             return manager.find(Cabin.class, pKey);
  |     }
  | }
  | 
If you need SOAP header you have to create and wire up a message handler to 
work with SAAJ.
Cheers,
Arno

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961246#3961246

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961246
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to