I am new to Java.I know that there are two types of web service
- SOAP Webservice.
- RESTful Webservice.
can any one please tell me what is the basic difference between both of them.And in which situation the SOAP Webservice
is created and in which situation RESTful Webservice
is created.
Thank You,
You could also have googled for this; this is a nice article on the subject: http://geeknizer.com/rest-vs-soap-using-http-choosing-the-right-webservice-protocol/
At a very basic level , SOAP is a messaging protocol , REST is a design philosophy , not a protocol. When you base a WebService on a SOAP protocol , you basically comply with SOAP rules of creating a Service Request , posting the request to server , receiving the request at server , processing the request and returning the results as a SOAP message.SOAP does not talk about the exact manner in which client benefits from the service, nor about how to design the client itself ( apart from the message it is posting ), it only tells how a message from client can be sent to service and back.
REST is short for REpresentational State Transfer. It does not specify the rules to create a message and post it to server. You can do this by simple HTTP protocol. What REST specifies is the manner in which client and server manage their states so that they become useful to the client -server communication. Here , you are more focussed on designing the states of clients and servers rather than the messages they are exchanging.
As the first answer allready explains, SOAP Webservices and REST Webservices differ in various points.
SOAP:
A good but not so easy to start with framework for SOAP WS is Apache CXF
REST (no hands on experience up to now, feel free to correct and improve ;) ):
I am sure, there are several other points I missed. But I think it's a usefull start.