tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philipp Bunge <>
Subject Re: JAX-RS and OpenEJB
Date Wed, 13 Jan 2010 15:15:22 GMT
> For example they call and should
> recieve a XML-document with data.
> So if you have some code..... let me see it :-)

So, assuming you have openejb integrated with some servlet container
you can write a Resource as follows:

public class CustomersResource {

    public DocumentWithData getNotPaidDocument() {
        try {
            InitialContext ctx = new InitialContext();
            MyService service = (MyService) ctx.lookup("ejb/MyService");
            return service.getDocument();
        } catch (NamingException e) {
            throw new WebapplicationException(e);


If DocumentWithData is JAXB annotated, it will be serialized
automatically, otherwise you can write your own MessageBodyWriter (see
the JAX-RS spec on how to do this).

I use Jersey as my JAX-RS implementation. Don't know if there are
others at the moment.


View raw message