TCM
TCM

Reputation: 16920

Why can't i create a RESTful web service in ejb module?

I am using Netbeans 6.8. I can see an option to create a web service in my independent ejb module but i can't seem to find an option to create a RESTful based web service in my ejb module. Is there any kind of restriction in ejb module that i can only create SOAP based web service and not RESTful? or is it the bug of Netbeans 6.8?

Upvotes: 3

Views: 3726

Answers (4)

TP_JAVA
TP_JAVA

Reputation: 1002

Write a wrapper class to the EJB which you are going to mark it as restful webservice with Jax-rs annotations with support of CXF rest api or Jersey api.

Upvotes: 0

stacker
stacker

Reputation: 68992

I found an article about EJB 3.1 and JSR-311 REST but I've to admit that I never tried it.

Upvotes: 2

ewernli
ewernli

Reputation: 38625

Chapter 2.6 of the EJB3 specs:

To support web service interoperability, the EJB specification requires compliant implementations to support XML-based web service invocations using WSDL and SOAP or plain XML over HTTP incon- formance with the requirements of the JAX-WS[32], JAX-RPC[25], Web Services for JavaEE[31], and Web Services Metadata for the Java Platform [30] specifications.

In other words: EJB3 can be exposed only as SOAP web service.

Upvotes: 3

duffymo
duffymo

Reputation: 309008

REST is just HTTP, usually implemented with servlets, so it would naturally be added to a WAR file that may or may not be packaged into an EAR with EJBs.

I don't believe that EJBs know or care about SOAP or REST. EJBs use RMI as their communication protocol of choice.

Upvotes: 2

Related Questions