MainMenu

Home Core Java Overview Maven Tutorials

Wednesday, 21 February 2018

Overview of Webservice




What is webservices ?


It's a simple xml based information exchange system, which uses internet for direct interaction between applications.

Watch Video


Components of webservice :
SOAP : Simple object access protocol
UDDI : Universal description and discovery integration.
WSDL :web services descriptive language.
Note : WSDL is a language , used by UDDI.
WSDL(Web Services Description Language)
WSDL is a language for describing web services and how to access them.
ESDL is written in xml.


What is SOAP ?
It is technology which allow communication between different languages. It allow us to pass the data over the internet in easy way.

A simple definition :
SOAP stands for Simple Object Access Protocol.
SOAP can interact with other programming language applications.
It is a just protocol which is XML Based for accessing web services over the internet.
It is recommended by W3C for communication between two application over the network.

Feature of SOAP :
1).It is a communication protocol designed to communicate via internet.
2).It can extend HTTP fro XML messaging.
3).It provide data transport for web services.
4).It can exchange complete documents or call a remote procedure.
5).It can be used for broadcasting a message.
6).It is both platform and language independent.
7).It is the XML way of defining what information is sent and how.
8).It enables the client applications to easily connect to remote services and invoke remote methods.


What is SOAP Message ?
SOAP Messages are just like post-box letter, in letter we have english text and in SOAP message we have XML.
As post-box have envelope, address, message, sender details etc. same in SOAP it have envelope, header, body & fault.

A SOAP message is an ordinary XML document containing the following elements −
Envelope − Defines the start and the end of the message. It is a mandatory element.
Header − Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end-point. It is an optional element.
Body − Contains the XML data comprising the message being sent. It is a mandatory element.
Fault − An optional Fault element that provides information about errors that occur while processing the message.

SOAP Message Structure

What is WSDL ?

WSDL : Stands for Web Service Description Language
1).It is a bese file which is used to describr web service and how to access them.
2).It is written in XML
3).WSDL is the document in XML. Which describe the webservice, the location of that webservice and operations exposed by webservices.
4).WSDL is written in simple XML.


Example of WSDL:-

Click Here or open below link in your browser
http://www.webservicex.com/globalweather.asmx?WSDL

WSDL have following major elements :-


type :Describe the data type used by webservices.
message :Messages used by web services.
porttype :Operation performed by web service.
binding :Communication protocols used in web service.

Advantage of SOAP :
SOAP has its own security known as WS Security.
Language and platform independent.
Disadvantage of SOAP :
It support only XML format, it has many standards which we have to follow while working with SOAP UI so that the reason it is slow.
It works with WSDL file onle so we can not use other format like JSON, header , Cookies and so on.



What is REST ?
RESTFUL WEB SERVICES :
REST stands for Representational State Transfer

It is platform dependent
It support multiple format like Json, HTML, XML, Plain text file too.
It is fast as compared to SOAP.
It is not a protocol like SOAP it is just a architectural design.



How WebServices works ?


A web service enables communication among various applications by using open standards such as HTML, XML, WSDL, and SOAP.
A web service takes the help of −
XML to tag the data
SOAP to transfer a message
WSDL to describe the availability of service.

OR In another way
Used XML for tagging >> Transfer it to SOAP >> WSDL to get the availabilities of services.

A simple definition: A web service is a function that can be accessed by other programs over the web (Http). To clarify a bit, when you create a website in PHP that outputs HTML its target is the browser and by extension the human being reading the page in the browser. A web service is not targeted at humans but rather at other programs.


Example: I can go to maps.google.com, and type in my home address, and see a map of where I live in my browser.
But what if you were writing a computer program where you wanted to take an address and show a pretty map, just like Google maps?
Well, you could write a whole new mapping program from scratch, OR you could call a web service that Google maps provides, send it the address, and it will return a graphical map of the location, which you can display in your program.

API vs WebService

API and web service both used for communication.
The only difference is that a Web service facilitates interaction between two machines over a network. An API acts as an interface between two different applications so that they can communicate with each other. An API is a method by which the third-party vendors can write programs that interface easily with other programs.

Summary:

1. All Web services are APIs but all APIs are not Web services. as all tigers are cats but not all cats are tiger

2. Web services might not perform all the operations that an API would perform.

3. A Web service uses only three styles of use: SOAP, REST and XML-RPC for communication whereas API may use any style for communication.

4. A Web service always needs a network for its operation whereas an API doesn’t need a network for its operation.

SOAP Vs REST


SOAP is Simple Object Access Protocol
Request and Response > XML Format
Uses Web Services and more secure.

SOAP
REST
SOAP is a ProtocolREST is an architechtral style
SOAP can not use REST beacuse it is a protocolREST can use SOAP web service because it is a concept and can use any protocol like HTTP, SOAP
SOAP uses services interfaces to expose the business logicREST uses URI to expose business logic
SOAP defines standars to be strictly followedREST does not define too much standard like SOAP
SOAP Requires more bandwidth and resource than RESTREST requires less bandwidth and resource than SOAP
SOAP defines its own securityRESTful web services inherits security measures from the underlying transport
SOAP permits XML data format onlyREST permits different data format such as Plain text, HTML,XML, JSON etc.



Representational State Transfer,
Each URI is representational of some object.
Uses Http get/post/put/delete and uses XML/json/html format
Totally stateless and light weight than soap
Not a protocol rather a architechtural style.



Advantange of REST Services over SOAP Services :

1).Rest Services are light weighted
Means less data transfer between client and server machine, ultimately need less bandwidth and fast.
in non-technical word : SOAP is just like post-office letter/courier where REST is just like post-card.

2).In case of SOAP Service, we can access complete application by using WSDL but in case of REST we can access only 1 functionality(Resource) by using URI, no need to access complete application.
Advantange for service provider is that they can sell complete application as well as only part of application, it will bring more small customer to it.

3).Soap Support only XML format for data exchange. Rest support HTML, XML, JSON , plain text, PDF etc.

4).SOAP service mainly support GET but Restful services uses for main HTTP methods :
a).GET to retrieve resource
b).POST to create resource
c).PUT to update resource
d).Delete to delete resource

5).SOAP defines standards(W3C) to be strictly followed(Which will take more time to develop, test and use) but REST does not define too much standards like SOAP.

What is URI ?

URI : Uniform Resource Identifier
Identifyng documents using a short of numbers, letters and symbol.


URL and URN A URN(Uniform Resource Name) ia an internet resource with a name.

Example of URI :
http://www.thomas-bayer.com/sqlrest/CUSTOMER
http://www.thomas-bayer.com/sqlrest/CUSTOMER/2
http://www.thomas-bayer.com/sqlrest/CUSTOMER/3

WSDL Vs WADL

WSDL : The web service description language(WSDL) is an XML vocabulary used to describe SOAP-based web services.
WSDL files that we will be using for SOAP based web services only.
It's major elements are :
Definition : root element of all WSDL documents, It defines the name of the web service, declares multiple namespaces used throughout the remainder of the document, and contains all the service elements described here.
Datatype : The data types to be used in the messages are in the form of XML schemas.
Message : It is an abstract definition of the data, in the form of a message presented either as an entire document or as arguments to be mapped to a method invocation.
Binding : It is the concrete protocol and data formats for the operations and messages defined for a particular port type.
Operation : It is the abstract definition of the operation for a message, such as naming a method, message queue, or business process, that will accept and process the message.
Port : It is a combination of a binding and a network address, providing the target address of the service communication.
Service : It is a collection of related end-points encompassing the service definitions in the file; the services map the binding to the port and include any extensibility definitions.



WADL : The web application descrition language(WADL) is an XML vocabulary used to describe RESTful web services and XML vocabulary for expressing the behaviour of HTTP resources.
main porpose to define the contact.


What is SOAP UI?


Soap UI is an open-source tool used for functional and non-functional testing,widely used in web-services testing.


SOAP UI important feature


1).It is capable of performing the role of both client and service.
2).It enables the users to create functional and non-functional tests quickly and in an efficient manner using a single environment.
3).It is licensed under the terms of the GNU Leaser General Public Licence.
4).It is purely implemented wing JAVA platform.
5).It supports Windows, Mac, multiple Linux dialects.
6).It allows testers to execute automate functional, regression, compliance and load tests on different WEb API.
7).It supports all the standard protocol and technologies to test all kind of APIs.

1).Soap UI is a tool from Samrtbear mainly for functional testing but it can also be used for non functional testing like performance, security of web services.

2).Web services can be created either by SOAP or REST method, we can work with both.

3).There are two version of SOAP UI in market :
SOAP-UI free
SOAP-UI Pro paid.

WebService

1). Webservice is the type of application or software component which does not provide any GUI for user to interact.

2). We can interact that kind of application passing input to specified XML format and receiving result in XML.

3). Webservive use HTTP protocol to communicate wth web service.

4).Web services are powered by XML and thee other core technologies: WSDl, SOAP and UDDI.

Type of WebService


SOAP Services (WSDL File)
REST Services (WADL File, URI)


Demo Soap Services
http://wsf.cdyne.com/WeatherWS/Weather.asmx?WSDL

WorkSpace

1).In Soap UI first we need to create a workspace.
2).Workspace is a place where all our projects will be saved.
3).Workspace is a single XML file, we have multiple projects in a sigle workspace.
4).It is Simillar like Domain, we can have multiple projects in a single domain.



How to download and install the SOAP UI


navigate to below url :
https://www.soapui.org/downloads/soapui.html
or click here

Click here to download from drive







No comments:

Post a Comment