File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Web service client can only be SLSB / SSB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Web service client can only be SLSB / SSB" Watch "Web service client can only be SLSB / SSB" New topic
Author

Web service client can only be SLSB / SSB

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775
On p7 of Frit's notes,

1.1.1 Web service client
The client can only be stateless session bean or singleton session bean


I think a web service client can neither be a bean or not a bean.
That means, a web service client may not be annotated with @Stateless or @Singleton.

Mike Degteariov
Ranch Hand

Joined: Oct 03, 2007
Posts: 62
    
    8

Hey Himai



This is not true, sorry.

For SOAP-based web services, the client (i.e. the java code that actually handles binding, marshalling, and http communications) is typically generated from WSDL using a tool (wsimport which is bundled with Oracle SDK or wsdl2java for CXF-based services).
Along with other classes and interfaces, a client code (i.e. the code that is used to call a SOAP-based web service) is generated, and this code is neither stateless nor singleton bean. In fact, it is not EJB at all - it is an annotated POJO.
Provided that these generated client classes are available through classpath, they can be used by class of any type.

For RESTful services, any JAVA class can be the client. All you need to call REST web service is java.net.HttpURLConnection - so any class can do it, there is no restrictions.

Note that you do not need Java at all to call RESTful services, depending on HTTP method implemented they can be called from unix command line using curl or wget, or even right from web browser.


Mike Degteariov
SCJP5 SCWCD5 SCBCD5
Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 775
Hi , Mike.
I agree with what you mentioned. A web service client may neither a stateless bean nor singleton bean.

Also, I guess it may be possible to have a bean as a client that calls the methods of a web service.

In Frit's notes :

A web service client can only be stateless session bean or singleton session bean.

I don't understand this quote.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1696
    
  25

Hi Mike and Himai,

You are both correct. What I meant is that only Stateless session beans and Singleton session beans may have web service clients.

I will update the notes, thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web service client can only be SLSB / SSB