When to use EJB and WebServices?
How I understand, EJB used for abstracting from implementation (realizations details), because it exposes only interface and it can be injected (using @EJB).
Web-services gives us more abstraction then EJB, because they can hide not only implementation details, but also language in which it was written.
So if we know that our clients is Java programs, we can make EJB (because it’ more convenient, it don’t require writing xml-json serializers/deserializers). And if we know that client program may be written on C#, php etc. so we must make web-service (but it less convenient in using)? And it is good to use EJB inside Web-Services? (ejb backed web-service)?
Thanks!
When your consumers are always in java technology you can opt for EJB. If your consumers are on different technology you can prefer web services.