Best Practices
Web services are simply XML services that are shared by and used as components of web-based applications. Depending on different technologies, scenarios, and computer configurations, these services can reside on dissimilar computers and can be accessed and transported using different standard protocols. Though these protocols are different, these services are made interoperable because XML is the language used as the message format, the services themselves can be encapsulated via XML, and the services can be accessed on the Internet from the different applications. The following sections will go over some alternative mechanisms for transporting messages.
SOAP vs. JAX-RPC
Java API for XML-based RPC (JAX-RPC) is a Sun Microsystems Java Specification Request (JSR) that specifies the client API for invoking a web service. The java.xml.rpc interfaces consist of the main client interface, the factory class for creating the main client interfaces, the client proxy for invoking the operations of a web service, the call interface used to dynamically invoke a web service, and an exception class that is thrown if a web service error occurs. This specification is more interface-driven, i.e., methods, parameters, return values, and synchronous, meaning that the client waits for the response; in short, more RPC-style.
SOAP vs. JMS
Java Message Service (JMS)—or message Enterprise Java Beans (EJBs)—is more message-style than SOAP, in that it’s more message-based and asynchronous and involves sending or receiving an XML document. Inherently, with the use of EJBs, the traditional facilities of persistence, security, transactions, and concurrency are available with these messages. Essentially, two types of operations exist with JMS: operations that send data and operations that receive data. JMS can send messages to the JMS destination, which then forwards it on the client, and JMS can also receive messages from the JMS destination that received a message from the client.These operations contrast with SOAP in that there needs to be a Java-compatible JMS client receiving these messages, whereas the SOAP message is platform independent and can support a broadcast protocol that doesn’t depend on getting responses.