File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Service locator as the service? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Service locator as the service?" Watch "Service locator as the service?" New topic

Service locator as the service?

Pavan Tummala
Ranch Hand

Joined: Dec 25, 2004
Posts: 74
I have 2 services (session beans) which will be exposed as webservice for a webmethods client.
How do I go about exposing these 2 beans as a service. Can I expose the servicelocator itself as a webservice? I know the 2 session beans can be individually exposed as services, but how about servicelocator?
Any example would be great.

If Java had true garbage collection, most programs would delete themselves upon execution -- Robert Sewell
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Well with webservices it depends on the message, are they the same? The sender to the web service might not have your Service Locator, or even be written in Java. You expose your webservice with a URL and SOAP and XML Schema definitions. The web service should just wrap around your EJB.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
Thomas Taeger
Ranch Hand

Joined: Dec 16, 2002
Posts: 311
Originally posted by Pavan Tummala:
Can I expose the servicelocator itself as a webservice?

Hi Pavan,

the service locator is the client-side common code to [mostly remotely] locate/lookup an EJB via JNDI, a webservice or whatever service.

The service locator can not and needs not lookup itself remotely - it knows itself already - locally!
Therefore there is no use to expose the service locator as a webservice.

You may locate
- a webservice URI via a JNDI provider or
- a JNDI provider URI via a webservice,
but these seem to be usefull only if you whish to provide both kinds of protocolls via one first contact point.

Probabely you just need to concentrate on writing one client-side servicelocator only, in your case the one for the webservice.

The use of a ServiceLocator is
- to encapsulate this uggly locater-implementation in one common client-side object and
- to allow for optimizations like caching handles.

Good luck,
Thomas Taeger -
Interfaces are the glue of OO.
I agree. Here's the link:
subject: Service locator as the service?
It's not a secret anymore!