UFT API – Are RPC Web Services Supported?

PerfectoTopAd

Does UFT API support RPC web services?

I've been asked this question several times. The current version of UFT API/Service Test does not support RPC type web services. If you need more information about the RP support, I wouldn't be able to explain it any better than the HP help documentation about RPC services:

Service Test enables you to import both Document/Literal and RPC type Web services. In Document/Literal Web services, the client sends standard XML documents to the server. The server application is responsible for mapping the server objects (properties, method calls, and so forth) and the values in XML documents. The data is serialized according to a given schema, so it can be validated against the schema. For Document/Literal type Web services, Service Test displays the input and output properties in a grid, allowing you to assign values for each property independently.

In RPC type Web services, the WSDL file and SOAP body contain the complete operation name, its input and output properties, and their values. There is no schema for this type of service and it is not supported by the WS-I conformance standard. Service Test does not display the input and output properties for RPC type services.”

One possible way to test an RPC service

Although RPCs are not officially supported, I'll show you how I was able to work with an RPC service from the National Digital Forecast Database (NDFD) using Unified Functional Testing.

Before we create our test, we'll need some XML that will be used to send to the NDFD web service.

http://graphical.weather.gov/xml/docs/SOAP_Requests/LatLonListZipCode.xml

  • Save to the response returned in your browser by clicking on the browser's File>Save As menu option. Use ndfdXMLclient.xml as the filename and save to a local drive.


Make a request to an RPC service using UFT API

Now that we have the XML, let's take a look at how to use it in our request to the NDFD.

  • Create a new UFT API test named APITEST_Weather
  • Click on Import WSDL and enter the URL Address:


http://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl.

  • Under the Toolbox, find the nfdXML web service and drag the LatLonListZipCode on to the main canvas area.


  • Under the LatLonListZipCode's Properties, click on the XML Body tab.


  • Click on the Load XML button and point to the LatLonListZipCode.xml sample we saved earlier. The operation's input values should populate.
  • In the listZipCodeList, enter the zip code for Boston (02201).


    • Run the test.
    • The test should pass in the HP Run Results Viewer. Click on the LatLonListZipCode step.


    • Under the Captured Data area, click on the Response link.


    • Look at the latLonList element values in the response (42.3583, -71.0603I) and enter them into a Google search, which should return the following:




As you can see, we have verification that the tests worked. We sent a Boston zip code, and the API returned the correct latitude and longitude for that zip code. Cool!

Adding a Checkpoints to an RPC request

You could use custom code to create a custom validation point, but for this post I want to show you what I call a “lazy man's” checkpoint using the Replace String activity.

Sometimes you may be able to get the functionality you want in UFT API by using some of the existing activities available in unique ways.

This could save you time, being preferable to having to create custom code for everything that may not seem to have an activity to handle it. Don't get me wrong — custom code is great — but if I can use a method that is quicker and just as reliable, I'll use the easier method every time. Check it out:

  • Drag a String Manipulation>Replace String under the LatLonListZipCode activity.
  • For the Search String value, enter the latitude and longitude coordinates we expect 42.3583,-71.0603
  • For the Replace String, enter FOUND LAT & LON
  • Under Checkpoints, set the Result to Contains
    FOUND LAT & LON


  • Rerun the test.
  • The HP Run Results report's Replace String's
    Checkpoints
    Captured Data should show a pass status.


Not bad for being Lazy!

Not bad for a quick and dirty approach that requires no custom code whatsoever. I think it's pretty cool!

More UFT API Automation Awesomeness

For more UFT API Automation Awesomeness, tips, tricks and how-tos, check out my new book, The UFT API Testing Manifesto – A step-by-step, hands-on testing guide for the masses, available on Amazon.com!

Don’t own a Kindle? No Problem — you can still read my UFT API book!
I’m aware that some of you have had trouble accessing my books in the past. The truth is that you don’t need a Kindle! There are a variety of free ways you can read a Kindle eBook:

In short, it’s really simple to read Amazon Kindle books, no matter what type of device you use to access the Internet.

1 comment
Click here to add a comment

Leave a comment: