Problem solve Get help with specific problems with your technologies, process and projects.

When is it more appropriate to use SOAP or REST?

"When is it more appropriate to use SOAP or REST?"

When is it more appropriate to use SOAP or REST?

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.

Dig Deeper on Topics Archive

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.