package jeex.ejb.beans;

import jeex.ejb.domain.Topic;
import jeex.ejb.entities.TopicEntity;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.TypedQuery;
import java.util.ArrayList;
import java.util.List;

@Stateless
public class TopicManager implements TopicManagerLocal, TopicManagerRemote {
   @PersistenceContext
   private EntityManager em;

   void setEntityManager(EntityManager em) {
      this.em = em;
   }

   @Override
   public List<Topic> listTopics() {
      TypedQuery<TopicEntity> q = em.createNamedQuery(TopicEntity.findAll, TopicEntity.class);
      List<Topic> result = new ArrayList<>();

      q.getResultList().forEach(entity ->
            result.add(toDomain(entity)));

      return result;
   }

   private Topic toDomain(TopicEntity entity) {
      Topic topic = new Topic();
      topic.setId(entity.getId());
      topic.setName(entity.getName());
      return topic;
   }
}

@@ -115,16 +115,45 @@
 teless;%0A
+import javax.jws.WebService;%0A
 import j
@@ -329,16 +329,44 @@
 ateless%0A
+@WebService(name = %22topic%22)%0A
 public c

Make TopicManager session bean a bottom-up SOAP web service