Hi, this is the part two of the article where we are creating a complete AXIOM based web service with Axis2, If you haven't read the part one, please read it before going through this.
In this Post I will try to cover as much as possible regarding testing your webservice with SoapUI.
I will be using SoapUI 5.0 installed on top of Ubuntu 14.04.
Ok So lets begin.
SoapUI is a free tool that can be used to test web services. SoapUI can test SOAP and REST based web services, JMS, AMF, as well as make any HTTP(S) and JDBC calls. Learn more from here.
Install SoapUI on your PC, this can be done in two ways, Install SoapUI as a standalone Application or as a IDE plugin, I recommend to install this as a separate application.
Deploy your webservice created in part 1 and check whether it is deployed correctly as mentioned in that post.
Note : The "wsdl" function following the service name will give you the WSDL of the service.
So lets add the required content to the correct place. make sure that your namespaces matches the namespaces defined in the service. The final message will look like following.
The "setProduct" service is working fine now lets test the "getProduct" service.
Now click on Submit request button and the following output will be shown.
You have Successfully tested the web service you created, So in the next post I'll explain you how to write a simple client to access the service we created.
Thank for reading, and please feel free to drop a message or comment below if you have any issues. :)
In this Post I will try to cover as much as possible regarding testing your webservice with SoapUI.
I will be using SoapUI 5.0 installed on top of Ubuntu 14.04.
Ok So lets begin.
What is SoapUI
SoapUI is a free tool that can be used to test web services. SoapUI can test SOAP and REST based web services, JMS, AMF, as well as make any HTTP(S) and JDBC calls. Learn more from here.
Prerequisites
Install SoapUI on your PC, this can be done in two ways, Install SoapUI as a standalone Application or as a IDE plugin, I recommend to install this as a separate application.
Deploy your webservice created in part 1 and check whether it is deployed correctly as mentioned in that post.
Testing Your Service
Step 01
- Go to the Axis2 server URL and check whether the service is available. in my case the Axis2 services can be found at "http://localhost:8080/axis2/services/"
- Click on the title of your service and you will be shown the WSDL of your service.
Note : The "wsdl" function following the service name will give you the WSDL of the service.
- Copy the url of the WSDL.
Step 02
- Then give an appropriate name to the project and paste the link of the WSDL of your service as shown in the following image and click OK.
- Now your project will be created with all service methods of your service. Note that Soap Binding 1.1 and 1.2 are automatically created by SoapUI.
- First lets test the "setProduct" method. Select the request which is located under setProduct method in the Soap1.1 Binding option as shown below.
1 2 3 4 5 6 | <tns:setProduct xmlns:tns="http://myshop.com/xsd"> <tns:id>1</tns:id> <tns:model>Samsung</tns:model> <tns:price>100</tns:price> <tns:qty>6</tns:qty> </tns:setProduct> |
So lets add the required content to the correct place. make sure that your namespaces matches the namespaces defined in the service. The final message will look like following.
- Now click on the Submit Request button as shown in the above image. Nothing will be shown in the output window. :) Don't worry the service doesn't return anything so check the Axis2 console for any output. The Axis2 Console will show the following message if the request was successful.
The "setProduct" service is working fine now lets test the "getProduct" service.
- Now select the request of "getProduct" method and add the following SOAP content to the request. (make sure that you have already added the product you are going to query through setProduct method)
1 2 3 4 5 6 7 8 9 10 11 | <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.televisionshop"> <soapenv:Header/> <soapenv:Body> <!--Optional:--> <tns:getProduct xmlns:tns="http://myshop.com/xsd"> <tns:id>001</tns:id> </tns:getProduct> </soapenv:Body> </soapenv:Envelope> |
Now click on Submit request button and the following output will be shown.
You have Successfully tested the web service you created, So in the next post I'll explain you how to write a simple client to access the service we created.
Thank for reading, and please feel free to drop a message or comment below if you have any issues. :)
0 comments:
Post a Comment