views:

81

answers:

3

Hello,

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?

+1  A: 

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.

duffymo
Hi duffymo, web services are also in my opinion type of ejbs in java? since we can mark the webservice to be @Stateless similar to ejbs. Also my ejb module, btw i am talking about independent ejb module (.jar) not EAR contains web services (SOAP based) and it works just fine. All web services are inside .jar(my independent ejb module) and not .war
Ankit Rathod
You can annotate the EJB in a way so that the app. server will exposed it as web service, without adding anything more to your EJB project.
ewernli
Yeah ewernli, i said the same thing in my comment
Ankit Rathod
+2  A: 

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.

ewernli
Great! Thanks. Then finally i should drop the idea of using RESTful web services in my project.
Ankit Rathod
No, I disagree. Use REST if it's appropriate. You just shouldn't expect to do with EJB3 support. That doesn't mean it can't or shouldn't be done.
duffymo
+1  A: 

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

stacker