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.
SCJP5 | SCWCD5 | SCBCD5 | OCMJEA6
Joined: Jul 29, 2012
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.