How we can design a REST service which returns both JSON and XML depending on the request header?
SOAP stands for Simple Object Access Protocol. REST stands for Representational State Transfer. SOAP is a XML based messaging protocol and REST is not a protocol but an architectural style. REST does not enforces message format as XML or JSON etc. Since SOAP messages are wrapped in a SOAP envelope it can be sent over to any transport mechanism e.g. TCP, FTP, SMTP or any other protocol. On the other hand, RESTful Web services are heavily dependent upon HTTP protocol. SOAP uses services interfaces to expose the business logic.REST uses URI to expose business logic. SOAP has a set of standard specifications e.g. specification for security (WS-Security) , specifications for messaging, transactions, etc. Unlike SOAP, REST does not has dedicated concepts for each of these. REST predominantly relies on HTTPS. SOAP is strongly typed, has strict specification for every part of implementation. REST gives the concept and less restrictive about… Read more“SOAP and REST web service comparison”