Ask the Expert

When is it more appropriate to use SOAP or REST?

When is it more appropriate to use SOAP or REST?

    Requires Free Membership to View

It's more appropriate to compare REST (Represtational State Transfer) with SOA (service oriented architecture) than it is to compare REST with SOAP. REST is an architectural style. SOAP is a messaging protocol. REST applications may use the SOAP protocol, although in many cases they simply send XML messages over HTTP. The key advantage of using SOAP rather than simple XML over HTTP is that SOAP provides a mechanism to cleanly separate infrastructure functionality from application payload. HTTP messages include a header which can be used to pass session and security information, but it's capabilities for separating infrastructure from application payload are quite limited. A SOAP header can contain any type of information, which allows middleware to handle a lot more runtime processing for the application (such as routing, message transformation, security, auditing, persistence, accounting, and many other services).

REST is typically more scalable than SOA, so for very high scalability requirements I would lean more toward REST, but there are many other criteria to consider besides scalability. And you can make SOA scale if necessary.

I think the key consideration that developers and architects should consider when choosing between SOA and REST is the programming style and the experience of the developers. When using SOA, the application typically send a request message to the service indicating the requested operation and supplying input information in the message. The service processes the input message and returns a response message. (SOA can also support other message exchange patterns and asynchronous programming). When using SOA, the infrastructure can also perform automatic mapping of XML into language-specific objects (e.g., XML to Java).

When using REST, the application typically encodes all request information into the URL. (You probably wouldn't want to encode sensitive information, such as a credit card number, into a URL, though.) An application can also submit information for processing, such as a purchase order, using the POST method. When using REST, the application typically works directly with XML.

If developers are accustomed to working with language objects and using RPC or RMI style programming models, they will find SOA more intuitive. If developers are accustomed to working with SAX and DOM and using message style programming models, they will find REST more intuitive.

This was first published in April 2005

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: