Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between ordinary web-service and soap-based web service?

There are 2 types of web-services as I know. First one is custom xml formatted messages and the second one SOAP standard xml messages. What are the differences between them? Which one is better, what are pros and cons of each of that two approaches?

like image 703
dhblah Avatar asked Dec 27 '11 12:12

dhblah


People also ask

What is the difference between SOAP and web services?

Web services overview Web services are of two kinds: Simple Object Access Protocol (SOAP) and Representational State Transfer (REST). SOAP defines a standard communication protocol (set of rules) specification for XML-based message exchange. SOAP uses different transport protocols, such as HTTP and SMTP.

What is a SOAP based web service?

SOAP is a messaging protocol for exchanging information between two computers based on XML over the internet. SOAP messages are purely written in XML which is why they are platform and language independent. A SOAP message contains: An Envelope that indicates the start and end of the message.

What is the difference between Web service and RESTful web services?

1) Web API vs REST API: ProtocolWeb API supports protocol for HTTP/s protocol and URL requests/responses headers that enable services to reach various clients through the web. On the other hand, all communication in the REST API is supported only through HTTP protocol.

What is the difference between SOAP and REST web service call?

SOAP uses only XML for exchanging information in its message format whereas REST is not restricted to XML and its the choice of implementer which Media-Type to use like XML, JSON, Plain-text. Moreover, REST can use SOAP protocol but SOAP cannot use REST.


2 Answers

By "ordinary" I assume you mean RESTful services. This discussion would be a long one, so I'll try to give you some key points:

  1. RESTful services are the most used flavor of Web Services. They are closely linked to the functionality and principles of HTTP and can be accessed as simple as a GET request (other operations are POST, DELETE and PUT). The core concept is the "resource" which is identified by an URI. Common formats for REST are XML and JSON. It's a pretty straightforward and easy to use technology, which is what makes it so widely available.

  2. SOAP web services are based on XML, most of them adhering to the RPC-style of app design (calling remote methods on a server and getting a response), and use 3 main pillars:

    • WSDL - Web Service Description Language - used to describe a service in terms of available operations, parameters, etc.
    • SOAP - Simple Object Access Protocol - used to construct interaction messages between the entities involved (client, server).
    • UDDI - Universal Description, Discovery and Integration - used to classify and publish available web services to a repository and enable discovery by potential users.

SOAP Web Services tend to have high overhead and generally have very verbose messages, but may be good if you need to implement more complex functionality and interaction in your application.

like image 193
Tudor Avatar answered Jan 04 '23 00:01

Tudor


Strictly speaking only the Soap services are webservices. They are based on the WS-* Specs standardisized by W3C and Oasis. Sometimes a also reffered as Webservice are so called POX-Endpoint (Plain old XML) or REST Endpoint, which allows you to simply get a raw XML via HTTP GET.

SOAP Services carry their schema in form of a wsdl endpoint (usualy append ?wsdl to the service endpoint), so there a lots of tools to create proxy objects and hide the complexity of the webservice call. With POX Services you need to know which schema to use from e.g. the documentation.

SOAP Services carry the payload inside the SOAP Envelope (an XML Schema with header and body with the payload in the body). Having a header independent from the payload allows to reroute the content, sign and encrypt, authenticate etc. without knowing the content. But you pay by additional overhead in the message itself.

POX on the other hand leaves all that to the webserver and relies usualy on HTTP for authentification and compression. Encription and signing had to be done by your system. It is low overhead but also low discoverability.

Whats works best for you depends a lot on your scenario. If you work in a .Net or Java World, you often find it simplest to create a proxy and use that to work with the webservices as remote objects. You get a well build infrastructure and a comfortable programming experience. If youre environment does not support the proxy generation or if it had to be called from anything, POX might the very much more lightweight way to go.

like image 36
gbegerow Avatar answered Jan 04 '23 00:01

gbegerow