How to test multiple Web Services with one script using UFT? - web-services

I am trying to create a set of Regression Test scripts to test the different Web Services and the corresponding methods related to my Web Application in HP UFT. I am using the API testing feature of UFT. I have the request and response XMLs (obtained manually) of each web service method necessary for the testing. There are more than 50 web service methods to be tested. The test cases for all of them are same. The input data of the request is currently being set by parameterizing the data from an excel spreadsheet.
Since the test cases are exactly same and the input data for all the web service methods have similar fields, such as First Name, Last Name, LoginID etc., I want to know if there is a way to write a single script which dynamically reads the web service method name and the associated data from the spreadsheet and uses it in the request XML file (same name as the web service method) which is also loaded in run time.
In this way, after the script has been developed, all I need to do prepare a list of all the web service methods to be tested and enter them in the Test spreadsheet along with the required request data. The script would loop through all the web service methods and execute the test cases for each web service method one by one.

in your case I think you should use a Soap Request method rather than a Web Service Call. Using soap request, other than the message itself, you can parameterize also the Endpoint Address and the SoapAction
Hope this helps
Yossi

Related

Test auto increment function of web service with simultaneous users

I have a web service that does a simple task of 'auto-incrementing' a simple field.I test it using SoapUI. That is, whenever I run SoapUI, the response would be a value that is one plus it's previous value. Now, the catch is, I want to test simultaneous users running the same web service. Meaning, if they all access the web service at once, the web service will respond with the correct incremented value.
For instance, I have 3 users who accessed the service at the same time. I am expecting that the response (integer value) they would get will not be the same with each other. It should be incremental. That's what I want to test.
I'm thinking of maybe incorporating JMeter and SoapUI, but I'm not sure if that's even possible. Do you have any suggestions on how I can handle this?
SoapUI offers some limited load testing capabilities so if you think the load from one machine will be enough and you will be happy with the load test metrics which reflect only average/min/max response times and throughput - you can conduct your load test using SoapUI only.
If you decide to go for JMeter - be aware that you can migrate your test in at least 2 ways:
Record running SoapUI test scenario using JMeter's HTTP(S) Test Script Recorder
Taurus automation framework comes with SoapUI xml to JMeter jmx converter.
If you want to do it manually check out Building a SOAP WebService Test Plan JMeter User Manual chapter
In order to "tell" JMeter to execute HTTP Request samplers with the desired amount of virtual users at exactly the same moment add Synchronizing Timer as a child of the relevant HTTP Request sampler.

SoapUI: Create mock service with pass-through behavior for selected methods

While developing a web application I have the following use case:
a 3rd party Web Service with quite a lot of methods is deployed on a test server A (with a single endpoint, e.g. http://3rdPartyServer/3rdPartySvc?WSDL)
a new method is about to be implemented in the near future, but I need to use it now
the rest of the methods are used throughout my code extensively
So I would like to do the following:
Create a mock service in SoapUI locally, based on the new WSDL which includes the new WS method (i.e. a superset of the WS methods currently on server A)
point my local application server to use the SoapUI mock service endpoint
mock only the response of the new WS method (create a dummy response for it in SoapUI)
let the other WS method calls to reach server A and return whatever it returns normally (i.e. use SoapUI as a proxy for these calls)
I've gone through the SoapUI documentation regarding service mocking and have used it numerous times, but could not find an option for such "pass-through" behavior.
When you read in your WSDL, the endpoint will point to your server.
Open your service, and select the service endpoint.
Add a second endpoint, to point to your mock. SoapUI has little bit of documentation showing this here. Only step "2. Getting Started" applies, not step 3!
In each of your tests, where you are using the mocked method, you will need to select the mock endpoint. Further discussion is here.

How to handle SOAP service within persistent Perl web application with cookies?

Due to the fall of SOAP::WSDL which had generated me real Perl modules I have to look for something other in order to handle a SOAP service. The generated modules won't work starting from Perl v5.18.
I have the following situation with my web application.
I have a PSGI compatible, Dancer2 driven, persistent web application.
The web application handles multiple concurrent customers.
The web application is between the customer and an external SOAP service.
The SOAP service uses customer sessions via cookies which have to be integrated on the web application internally for the customer.
The web application holds an WSDL file copy of the SOAP service.
I'm looking for a module that creates an interface out of the WSDL file and handles parameter/schema validation and communication with the SOAP service. I would like to call a method (SOAP call) with parameters (SOAP call parameters) and receive a cleaned data or object structure of the response.
The problem is that the web application needs to handle multiple concurrent customer cookie sessions. So I need a module which offers the possibility to override the cookie jar for that particular request and extract the cookies after the request without causing interference with other concurrent requests.
I found XML::Compile which I can initialize as a singleton at web application start up. But with this solution I ran into problems with interfering other customer requests. So the requests are not separated. Initializing XML::Compile for every request is not the solution either because it will parse the WSDL and generate handlers over and over again for every request the customer sends to the web application.
Is there any solution/module that fits my needs or do I miss something with XML::Compile and it's possible with it?
Are you using Catalyst?
I've been happy using Catalyst::Controller::SOAP and its companion Catalyst::Model::SOAP to build SOAP/WSDL servers and consumers, being able to integrate Perl Applications even with Microsoft Document Literal-Wrapped thing.
Even if not using Catalyst you may probably learn from its code. It uses XML::Compile::WSDL11.

Remote Web service

I am new to web services. I have a requirement in my project. They gave me a wsdl file and a web service link and document about the description of methods.
In the documentation there is method called retriveDocuments with request parameters request, loginUser, loginPassword, systemId, maxResults, searchCriteria.
They want me call webservice and get the required documents and show them in app.
My question is how do I call web service and how do I pass all these parameters and get the result?
Most likely this a SOAP service. Your programming language (such as Java) should have tools allowing you to generate a SOAP client for the service, using the WSDL. Once you have the cient code, it should be easy to pass your parameters, make the call, and get the result. There are lots of tutorials on the Web, but you can start researching from there.

return a pdf in browser from web service

i am relative new in java development..
I want to create a web service (jax-ws)/web application that will receive some input and generate pdf, and then open the pdf in the browser. I manage to create the pdf (using itext) and open it in the broswer using servlet (with FileInputStream etc).
However i do not know, how to return the servlet from the web service.
What should I do, so when I call the web service to receive a pdf via the servlet ?
If you've returned PDF from servlet, it means your servlet sent PDF stream as output and probably set content type as "application/pdf". This works fine in the browser and this is the right way to do it.
However, you cannot easily invoke web service (no matter whether it is JAX-WS or any other stack) from the browser. Web service call requires POST and strictly defined SOAP content. You can, however, use AJAX to call web service, but that is a different story (also look at REST).
If you want to return binary data from web service (please keep in mind that web-services are for machines, not for humans using web browsers), you have two options: either serialize the binary data using base64 or use multipart HTTP response (MTOM standard, see for instance: http://www.mkyong.com/webservices/jax-ws/jax-ws-attachment-with-mtom).