6

What is the difference between webservice and HTTP service? I have used HTTP service with REST api. But not able to understand what do we use webservice keyword and what is the difference between these. Can any one help me to understand these things better.

4

Webservice specifically refers to a SOAP implementation, and HTTP simply refers to any service that uses the HTTP protocol, the most popular being REST and SOAP.

The difference is the "payload" of the body and some different headers. Both start off with the standard HTTP format:

ACTION PATH VERSION
Header: Value <repeat-as-necessary>

<body>

From there, they differ in how they are used. REST typically uses JSON, while SOAP uses XML with certain required formats.

SOAP is more bandwidth intensive than JSON, but tends to have better support in older software. There is a WSDL format that specifies how the SOAP messages should be formed, leading to quick development times (but, arguably, JSON is just as fast in most cases).

Normally, you'll choose the protocol based on your needs, usually determined by which format your programming language supports and the features you need to access from the service (SOAP and REST may not always offer the same API calls). Use REST when no other factors dictate a choice, and leave SOAP (webservices) if you need to use it.

  • thanks for your information, As you mention that webservices is SOAP implementation and HTTP protocol is used with soap and rest api both. Then what is the advantage of using webservices when we can handle both rest and soap in HTTP protocol. – Anu Mar 27 '15 at 6:28
  • The point of web services is that parameters passed into the function are exposed as native objects without having to parse the xml yourself, plus the ability to import a WSDL file directly into an IDE. Most languages only only support REST genetically, as in, you have to build the JSON yourself and parse the JSON yourself. While it's true that salesforce can do both natively, other systems usually have better support for web services, as it is an older protocol. – sfdcfox Mar 27 '15 at 14:03
  • If possible can you explain me by giving a sample code how these to work. Which will be more helpful for me. – Anu Mar 30 '15 at 5:54
  • Webservices (overloaded term) and API are 2 different things and somehow they overlap in most dicussions causing more confusion ! – Jasmine Feb 5 '19 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.