WHAT IS WEB SERVICE?
- A Web Service is a medium of Communication through which two Applications can transfer data irrespective of their architecture and technology.
- Web service is a standardized medium to propagate communication between the client and server applications on the World Wide Web.
WHY IS WEB SERVICE NEEDED?
- In general,when a person sends request to a software service,in return,it sends response in human readable format.
- In the modern era of technology, if you want to build a software application you don't need to build each and everything from scratch. There are lots of readymade services available which you can plug into your application and you can start providing those services in your application.
- The client would invoke a series of web service calls via requests to a server which would host the actual web service.These requests are made through Remote Procedure Calls(RPC).
WHAT IS RPC?
- Remote Procedure Call (RPC) is a protocol that one program can use to request a service from a program located in another computer on a network without having to understand the network's details.
EXAMPLE:
- As an example, Amazon provides a web service that provides prices for products sold online via amazon.com. The front end or presentation layer can be in .Net or Java but either programming language would have the ability to communicate with the web service
- The main component of a web service is the data which is transferred between the client and the server, and that is XML (Extensible markup language) a counterpart to HTML and easy to understand the intermediate language that is understood by many programming languages.
- So when applications talk to each other, they actually talk in XML. This provides a common platform for application developed in various programming languages to talk to each other.
TYPE OF WEB SERVICES
There are mainly two types of web services.
1. SOAP(Simple Object Access Protocol) web services.
- SOAP is known as a transport-independent messaging protocol.
- SOAP is based on transferring XML data as SOAP Messages.
- Each message has something which is known as an XML document. Only the structure of the XML document follows a specific pattern, but not the content.
- The best part of Web services and SOAP is that its all sent via HTTP, which is the standard web protocol.
2. REST(REpresentational State Transfer) web services.
- The REST style emphasizes the interactions between clients and services, which are enhanced by having a limited number of operations and this generally runs over HTTP.
- REST is an alternative to SOAP and instead of using XML for request, REST uses simple URL in some cases.
- Rest API supports both XML and JSON format. It is usually preferred for Mobile and Web apps as it makes app work faster and smoother.
WSDL(Web Service Description Language)
- SDL is an XML based language which will be used to describe the services offered by a web service.
- WSDL describes all the operations offered by the particular web service in the XML format.
- It also defines how the services can be called, i.e what input value we have to provide and what will be the format of the response it is going to generate for each kind of service.
WHAT IS WEBSERVICE TESTING?
- Web Services Testing is testing of Web services and its Protocols like SOAP & REST. To test a Webservice you can
1. Test Manually
2. Create your own Automation Code
3. Use an off-the shelf automation tool like SoapUI.
WebService Testing involves following steps -
1.Understand the WSDL file
2.Determine the operations that particular web service provides
3.Determine the XML request format which we need to send
4.Determine the response XML format
5.Using a tool or writing code to send request and validate the response
Steps 1 to 4:
Currency Convertor WSDL file can be seen @ (http://www.webservicex.net/CurrencyConvertor.asmx?wsdl) which will give the information about the Currency Convertor web service methods which it will support, the parameter which we need pass and the type of parameters… etc


Step 5:Using a tool or writing code to send request and validate the response
- There are lots of tools available to test web services. SOAPUI is one of the popular tool which will help us to test the web services.
- In fact you can use any programing language which is capable of sending the XML request to the web service provider application over the http and able to parse and validate the response XML against the expected result. In our case, we will test the WebService using SOAPUI.
USING SOAPUI TO TEST THE WEBSERVICE:
In SOAPUI
1.Go to File>New Soap Project
2.Enter Project Name and WSDL URL Name
3.Click Ok

1.Expand the first Request and Double Click on the 'Request1'. It will display the SOAP Request in the XML Format.
2.Enter the From Currency and To Currency.
3.Click on the Submit Button.
4.Response XML will be displayed Right Side Pane.

No comments:
Post a Comment