Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web service client can only be SLSB / SSB

 
Himai Minh
Ranch Hand
Posts: 1232
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 144
8
Java Mac MySQL Database Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Himai Minh
Ranch Hand
Posts: 1232
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Saloon Keeper
Pie
Posts: 2281
81
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic