Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Prerequisites: seam and cxf are configured and running.

Now to add seam support to a cxf webservice in tomcat:

Add the org.jboss.seam.webservice.SOAPRequestHandler in the cxf-servlet.xml spring config file:

            <bean id="seamHandler" class="org.jboss.seam.webservice.SOAPRequestHandler"/>

Then follow the strategy suggested in the seam documentation and build a conversation facade:

@Name(value = "conversationFacade")
@Scope(value = ScopeType.CONVERSATION)
public class ConversationFacade
    EntityManager entityManager;

    @Begin(join = true)
    public void invoke()

    public <T> List<T> getResultList(String query, Object... params)
        Query query1 = entityManager.createQuery(query);
        for (int i = 0; i < params.length; i++)
            Object param = params[i];
            query1.setParameter(i + 1, param);
        return query1.getResultList();

and reference it in your webservice implementation like this:

    private ConversationFacade getConversationFacade()
        ConversationFacade conversationFacade = (ConversationFacade) Component.getInstance(ConversationFacade.class, true);
        return conversationFacade;

Be sure to put all your business logic inside the ConversationFacade:

public doSomethingMsgReply doSomething(@WebParam(partName = "doSomethingMsg", name = "doSomethingMsg", targetNamespace = "") doSomethingMsg doSomethingMsg) throws MyFault
    doSomethingMsgReply doSomethingMsgReply = getConversationFacade().doSomethingMsgReply(doSomethingMsg);

    return doSomethingMsgReply;  

with doSomethingMsgReply(doSomethingMsg) something like this:

public doSomethingMsgReply(doSomethingMsg)