Testing a webservice is very easy and it can be done within minutes using SOAP UI.
The
best thing about SOAP UI is that it’s a free and open source
application, meaning anyone can have free access to the full source
code. Because soapUI is Java-based, it works on most operating
systems, including Windows, Linux and Mac. It also means you can
modify or customize it any way you like. And you can find everything
you need to know about soapUI at its official site soapUI.org.
Pre-requisite: We need a wsdl and that too up and running on a server. You can create your own wsdl file from my previous post below.
http://helptodeveloper.blogspot.com/2012/09/creating-basic-webservice-example.html
To check whether the service is up or not, you can just type the wsdl url in you web browser (there should be ?wsdl at the end of your url), you should see an xml file in your browser.
http://helptodeveloper.blogspot.com/2012/09/creating-basic-webservice-example.html
To check whether the service is up or not, you can just type the wsdl url in you web browser (there should be ?wsdl at the end of your url), you should see an xml file in your browser.
example of wsdl url: http://<host
> :
< port>/axis2/services/PalinServ?wsdl
Download
SOAP-UI (I used the 4.5.1 version for this example). Once you have
installed and run it, create a new project as below.
I am using a wsdl from my previous post http://helptodeveloper.blogspot.com/2012/09/creating-basic-webservice-example.html which returns whether the given number is Palindrome or not..
Give a
name to the project and give our wsdl url in the section provided,
and check the 'Create Requests' and 'Create TestSuite' (most often used by testers) and click OK button.
NOTE:
Make sure our service is up and RUNNING.
We can see our operations in the next window, make selections as shown below and click on OK button.
Provide a name for TestSuite.
It will
ask for both SOAP 1.1 and SOAP 1.2, repeat the same steps for SOAP
1.2 also.
Now
click on any request from either SOAP 1.1 or SOAP 1.2, you can see
the request how exactly it is going to send to our service using SOAP. Shown
below is the request from the SOAP 1.2 request.
Give
parameters in the args0 tag in place of the "?" and click
on the green play/run button in the left top corner of window Request
1. Then you can see the webservice response in the right most window
of the Request 1.
Here is the output for a non-palindrome number.
We can find the reason for the above fault code in the
wsdl file where the data type is defined as int, see below the
snippet from wsdl file
<xs:element minOccurs="0" name="args0"
type="xs:int"/>
No comments:
Post a Comment