What are the big advantages from JMS over Webservices or vice versa?
(Are webservices bloated? Is JMS overall better for providing interfaces?)
EDITED after correction from erickson:
JMS requires that you have a JMS provider, a Java class that implements the MessageListener interface for processing messages, and a client that knows how to connect to the JMS queue. JMS means asynchronous processing - the client sends the message and doesn't necessarily wait for a response. JMS can be used in a point-to-point queue fashion or publish/subscribe.
"Service" is a fluid term. I think of a service as a component that lives out on a network and advertises a contract: "If you send me X I'll perform this task for you and return Y."
Distributed components have been around for a long time. Each one communicated using a different protocol (e.g., COM, Corba, RMI, etc.) and exposed their contract in different ways.
Web services are the latest trend in distributed services. They use HTTP as their protocol and can interoperate with any client that can connect via TCP/IP and make an HTTP request.
You can use SOAP or RPC-XML or REST or "contract first" styles, but the underlying idea of a distributed component using HTTP as its protocol remains.
If you accept all this, web services are usually synchronous calls. They need not be bloated, but you can write bad components in any style or language.
You can start designing any distributed component by designing the request and responses first. Given those, you choose JMS or web services based on what kind of clients you want to have and whether or not the communication is synchronous or asynchronous.
Message based systems, including JMS, provide the ability to be "chronologically decoupled" from the other end. A message can be sent without the other end being available.
All other common A2A approaches require the partner to be able to respond immediately, requiring them to be able to handle peak loads, with little ability to spread processing.
I'd say the biggest distinction is that JMS is message-oriented, rather than RPC-oriented. Out-of-the-box, most JMS providers support high-level protocols that perform retries, prevent duplicates, and support transactions.
There are many applications where these capabilities are unnecessary. But where they are needed, building them yourself on top of an RPC mechanism is complicated, expensive, and error-prone.
Web services are an implementation of Services Oriented Architectures (SOA). A SOA has three parties: a provider, a broker, and a requester, which are loosely coupled. The provider offers a business service that represents a particular implementation, which is not directly visible to the requester. The requester learns from the broker the information structure that it has to send and receive from the provider and what protocol to use to access that service. The requester has no knowledge of the way the provider implements the business service.
Web services are defined as required business interfaces between a requester and a provider, and not as a common pipe for all business requests. There are several variables that can characterize web services, including that:
JMS is an asynchronous message-based interface. You can also use JMS to access business logic distributed among heterogeneous systems. Having a message-based interface enables the following functions:
Point to point and publish/subscribe mechanisms. Message-based frameworks can push information to other applications without their requesting it explicitly. The same information can be delivered to many subscribers in parallel.
Rhythm independence. JMS frameworks function in asynchronous mode but also offer the capability of simulating a synchronous request/response mode. This allows source and target systems to work simultaneously without having to wait for each other.
Guaranteed information delivery. JMS frameworks can manage the messages in transactional mode and ensure message delivery (but without any guarantee of timeliness of delivery).
Interoperability between heterogeneous frameworks. The source and target applications can operate in heterogeneous environments without having to handle problems of communication and execution related to their respective frameworks.
Making exchanges more fluid. The switch to message mode allows finer-grained information exchange.
let me talk w.r.t SOAP protocol implementation of web services...which is better JMS vs webservices....JMS provides transport protocol and it is underlying messaging provider which depicts how much good or bad is ur JMS provider for e.g. MQ is a powerful reliable JMS provider where as SOAP protocol can be considered both application level protocol and can also be treated as a transport protocol (in sense of SOAP/HTTP)...the beenfit of SOAP is in support of XML based standard...as an application level protocol, we consider SOAP as a message to be passed from one system to another over any transport protocol where as a transport protocol, SOAP can be considered as a container for transporting a payload(message data)...SOAP/HTTP can also be looked as JMS meesaging provider....but in latter form, HTTP has issue of reliablity, as it invloves errors related to networking, socket connections, bandwidth etc...so keeping long story short, JMS with reliable message provider makes it good standard for interacting with good transport protocol where webservice as an application level protocol makes disparate application to communicate using XML-like-SOAP protocol...hope this clarifies...
From the ones I've done here's the differences I've found: JMS - I'm tied to the JMS provider - however I have choices of implementation type (pub/sub, point to point) Web Service - easier to handle/architect - however its more of a direct communication between the boxes. Lots of tools to use to do the development - and a clean interface (WSDL's) so implementor and caller can be independent.
Which one to use? Depends on what the problem is.
Would add this as a comment to dyffymo's post, but don't yet have the rep.
Quoting from your answer:
"Web services are the latest trend in distributed services. They use HTTP as their protocol and can interoperate with any client that can connect via TCP/IP and make an HTTP request.
You can use SOAP or RPC-XML or REST or "contract first" styles, but the underlying idea of a distributed component using HTTP as its protocol remains."
I'm assuming by web services you mean the WS-* set of protocols, WSDL, and SOAP. If so, then none of these require the use of HTTP as the "transport" protocol. The SOA set of protocols was designed to be agnostic as to the tramission protocols used, so you can use HTTP, NamedPipes, raw TCP, and even JMS as the means to transmit messages to and from a web service.
So in the case of direct use of JMS vs. use of "web services" I think it mostly boils down to tooling, comfort level, and whether you really need direct access to some JMS specific feature (which using WS-* would hide from you). At this point I would think that only fairly specilized applications would require raw JMS access.
It all depends on your requirements, what frameworks will you use and your applications environment and behavior . If you can give an overview about that then you can get a rigid answer.
It's now like comparing a truck with a sedan car, You must know what will you use it for and on which road to be able decide which one is better.
JMS and WS both enable distribute applications. The difference is asynchronous(JMS) vs synchronous (Web Services). Web Services can be implemented in SOAP or REST styles. JMS is a api which supports communication in two modes - point-to-point and publish-subscribe. Apache ActiveMQ, RabitMQ are some of the many JMS implementors.