After writing Step by Step tutorials on Developing SOAP HTTP Web Service in TIBCO, SOAP JMS Web Service in TIBCO and RESTFul Web Service in TIBCO, some people asked me to write about differences between SOAP and RESTful Web services and also about Pros and Cons of using SOAP or RESTful web services in TIBCO.
In this post, I will talk about key differences between SOAP and REST web services and also discuss about usage scenarios for such web services in TIBCO BW.
What is SOAP?
SOAP (Simple Object Access Protocol) is a well known standards based protocol which is used to develop web services. SOAP exposes web services which are based on a contract (wsdl) with a set of operations with XML based messaging structures.
SOAP uses transport mechanism like HTTP, HTTPS, JMS etc. for enabling communication between SOAP Clients and SOAP Server.
SOAP Web Services comprise of following key structural elements:
- WSDL (Web Services Description Language)
WSDL is a XML based document which describes complete structural details of a web service including its operations, operation’s input, output and fault messages. Concrete WSDL also includes transport details of the web service so that any SOAP Client is able to access the service operations.
- Web Service Operations
SOAP Web Service comprises of a set of operations which can be consumed by a client. SOAP Operations expect some input parameters in XML structure and return back XML based response messages.
- WSDL Messages
Input and output parameters of any operation of a SOAP Web Service are defined by WSDL Messages. WSDL Messages use XSDs (XML Schema Definitions) to represent the message structures.
There are three types of WSDL Messages that can be associated with a Web Service Operation:
- Input Message
- Output Message
- Fault Message
SOAP Web Service PortType is same as a Class in Object Oriented Programming. The way methods are included inside a Class in OOP, Operations are included inside a PortType in SOAP Web Services.
What is REST?
REST (Representational State Transfer) is an architectural style for designing Public APIs and networked applications in the form of Web Services. REST is a lightweight and non-standardized approach towards development of Web Services as it doesn’t comply to any hard and fast standards unlike SOAP.
REST based Web Services are called RESTful web services and such services use HTTP Protocol for data transport. XML, JSON etc. are used as data formats for input and output of RESTFul web service operations.
What is the difference between SOAP and REST?
Below are some of the main differences between SOAP and REST Web Services:
- SOAP is a standard based approach to develop web services while REST doesn’t follow any specific set of standards.
- SOAP supports HTTP(s), JMS, FTP etc as transport protocols but REST supports only HTTP(s).
- SOAP web services only work with POST method while RESTful web services support POST, GET, PUT and DELETE methods.
- SOAP uses interfaces and named operations to expose business logic. REST uses (generally) URI and methods like (GET, PUT, POST, DELETE) to expose resources.
SOAP Vs REST in TIBCO
Talking specifically about Web Services development in TIBCO, you can use either of the two options as TIBCO provides palettes for Both SOAP and RESTful Web services.
For Development of SOAP web services, you can use SOAP and Service Palette in TIBCO Designer. WSDL Palette also comes into play when developing SOAP services. Refer to my below tutorials to get a complete idea of how we can develop SOAP Web services in TIBCO BW:
For developing RESTFul Web services in TIBCO, REST&JSON Plugin needs to be installed first. Once you have REST & JSON Plugin installed, you will be able to see REST related palette in your TIBCO Designer and then you can proceed with RESTFul Web Service development in TIBCO.
Refer to my below step by step tutorial for details:
I hope you liked the post. Feel free to contact me for any further help. Thanks