Java Login

About javalogin.com

Hello guys,
javalogin.com is for Java and J2EE developers, all examples are simple and easy to understand 

It is developed and maintained by Vaibhav Sharma. The views expressed on this website are his own and do not necessarily reflect the views of his former, current or future employers. I am professional Web development. I work for an IT company as Senior Consultant. Primary I write about spring, hibernate and web-services. I am trying to present here new technologies.


     << Previous
Next >>     


Types of Web Services

Web services describes a standardized way of integrating Web-based applications using the XML, SOAP, WSDL and UDDI open standards over an Internet protocol backbone. XML is used to tag the data, SOAP is used to transfer the data, WSDL is used for describing the services available and UDDI is used for listing what services are available. Used primarily as a means for businesses to communicate with each other and with clients, Web services allow organizations to communicate data without intimate knowledge of each other's IT systems behind the firewall.

There are mainly two types of web services.

  1. SOAP (Simple Object Access Protocol)  
  2. REST (REpresentational State Transfer)  

SOAP (Simple Object Access Protocol)

SOAP stands for Simple Object Access Protocol, it is a xml based protocol that enables the applications to communicate over HTTP. SOAP is a w3c standard, platform and language independent format for sending and receiving messages. The SOAP envelope contains two parts:

  • An optional header providing information on authentication, encoding of data, or how a recipient of a SOAP message should process the message.  
  • The body that contains the message. These messages can be defined using the WSDL specification.  

SOAP defines the XML-based message format that Web service-enabled applications use to communicate and inter-operate with each other over the Web. The heterogeneous environment of the Web demands that applications support a common data encoding protocol and message format. SOAP is a standard for encoding messages in XML that invoke functions in other applications. SOAP commonly uses HTTP, but other protocols such as Simple Mail Transfer Protocol (SMTP) may by used. SOAP can be used to exchange complete documents or to call a remote procedure.


Advantages of SOAP

  • It is platform and language independent.  
  • SOAP provides simplified communications through proxies and firewalls, as mentioned above.  
  • It has the ability to leverage different transport protocols, including HTTP and SMTP, as well as others.  

DisAdvantages of SOAP

  • SOAP is typically much slower than other types of middleware standards, including CORBA. This due to the fact that SOAP uses a verbose XML format. You need to fully understand the performance limitations before building applications around SOAP.  
  • SOAP is typically limited to pooling, and not event notifications, when leveraging HTTP for transport. What's more, only one client can use the services of one server in typical situations.  
  • SOAP has different levels of support, depending upon the programming language supported. For example, SOAP support within Python and PHP is not as strong as it is within Java and .NET.  

REST (REpresentational State Transfer)

REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications, it is primarily used to build Web services that are lightweight, maintainable, and scalable. A service based on REST is called a RESTful service. REST is not dependent on any protocol, but almost every RESTful service uses HTTP as its underlying protocol. Representational State Transfer (REST) is an architectural style that specifies constraints, such as the uniform interface, that if applied to a web service induce desirable properties, such as performance, scalability, and modifiability, that enable services to work best on the Web. In the REST architectural style, data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web. The resources are acted upon by using a set of simple, well-defined operations. The REST architectural style constrains an architecture to a client/server architecture and is designed to use a stateless communication protocol, typically HTTP. In the REST architecture style, clients and servers exchange representations of resources by using a standardized interface and protocol.


Features of a RESTful Services

RESTful services should have following properties and features:

  • Representations  
  • Messages  
  • URIs  
  • Uniform interface  
  • Stateless  
  • Links between resources  
  • Caching  

Difference between SOAP and RESTful Services

There are many differences between SOAP and REST web services. The important differences between SOAP and REST are given below:


SOAPREST
  • SOAP is a protocol through which two computer communicates by sharing XML document  
  • SOAP permits only XML  
  • SOAP based reads cannot be cached  
  • SOAP is like custom desktop application, closely connected to the server  
  • SOAP is slower than REST  
  • It runs on HTTP but envelopes the message  
  • Rest is a service architecture and design for network-based software architectures  
  • REST supports many different data formats  
  • REST reads can be cached  
  • A REST client is more like a browser; it knows how to standardized methods and an application has to fit inside it  
  • REST is faster than SOAP  
  • It uses the HTTP headers to hold meta information  

Which is more favourable?

REST was designed to be a more straightforward and easy to implement alternative to heavyweight SOAP for web service access. SOAP functions well in distributed environments where REST assumes a direct point to point communication. Also, SOAP allows for services to describe themselves to clients and in some languages allows for automation. On the other hand, REST is fast as less processing is required, uses less bandwidth and is closer to technologies used in web design.
The choice on which to use is totally dependent on what the requirement. For example, SOAP is a better choice for applications that have complex API so as to describe the services and methods, where formal contracts are agreed for the exchange format, where a guaranteed level of security is required etc. REST will be preferred when limiting bandwidth and resources, when operations are can be stateless and the information can be cached.


     << Previous
Next >>