rest services vs soap services code example

Example 1: Difference between SOAP and RESTful web services

RESTful:
	- is architectural style
	- stateless
	- requires HTTP
	- supports JSON, XML, HTML, CSV, plain text
	- easy documentation and easy to understand
	- efficient and faster
	- less bandwidth
	- less secure
	- Uses JAX-RS API for security

SOAP: 
	- ss XML based protocol itself
	- State or stateless
	- Can work with HTTP, SMPT(Simple Mailing Transfer Protocol), 
    FTP(File Transfer Protocol)
	- Only works with XML
	- Documentation is complex and hard to understand  
	- Slower than REST
	- More secure
	- Uses JAX-WS API for security
	- Platform and programming language independent

REST-Assured library helps us in testing our RESTful APIs easily. 
It integrates seamlessly with TestNG and JUnit. JSON Path and XML Path 
allows us to easily parse the response data and test specific elements. 
Since it uses Hamcrest matchers, there are many options to match actual 
result with expected data.

Example 2: when to use soap api

Use the SOAP API to create, retrieve,
update or delete records, like accounts
, leads, and user-defined objects.
With more than 20 different calls, 
you can also use the SOAP API to manage
passwords, perform searches, etc.
by using the SOAP API in any language 
that supports web services.

Tags:

Misc Example