My take on REST and SOAP
- Soap supports more RPC style of architecture where the use of SOAP is to invoke a remote function carrying in the message the function name and the various parameters. The RPC is basically a function that is sitting on a remote machine.
- The function has a specified number of parameters that needs to be provided to make use of the function. The use of SOAP is to make requests to such functions and to get the response back.
- SOAP uses XML to transfer the data and so it is heavy in size.
- The SOAP message is cryptic in the sense that it contains a header that wil specify the route, the info about the message and sometimes the security aspect for the message
- The SOAP message is difficult to create without the tools. So these days the langusgaes provide the library functions which will create the SOAP message
- The SOAP is generally sent using HTTP but other protocols are also valid like Java Message service
- SOAP is very function (verb ) centric. The way you get the things done is by calling a function so to get the stock prices you will call a function (web method: A webservice will have number of methods) getstock(GE)
Now the function will calculate the price and send it back to you
You must know the names of the function and the way it is going to use the parameters. For that you need to get the WSDL file which is very cryptic.
- SOAP syntax is not user friendly and human readable
- When SOAP makes the http request its difficult to find out which http method it is actually going to use.
In case of rest the functions are fixed it will be get, put, post and delete. You will mention the name of the stock directly while making the request (each object will have a different URI) so www.stockprice/category/stock/GE
In this case the description of how to make the call is very simple and its intuitive.
No extra tool is required, The call is very simple.
REST is only for http since it uses the protocols methods GET, PUT(Update), POST (create), DELETE. This is good since the user don’t have to find out which method will be used for a specific purpose. Its basically service_name/noun so Stock is a service and GE is the noun