UFT API – How to Dynamically Get and Set a WebService EndPoint

One of the more common questions I’m asked is “how do I set or get the current WSDL’s endpoint using custom code?” Unfortunately, HP doesn’t currently have a UFT API document that describes all the methods and properties for all of the UFT API classes/objects.

In truth it’s pretty easy, but to actually determine which method to use can be a real time-consuming, hit-or-miss process. So to save some time, you can set or get the web service’s Endpoint address (and for that matter, any of the General properties) in custom code or in an event using:

this.StServiceCallActivity5.TransportProtocol.SOAPProperties

FYI- your StServiceCallActivity number might be different than mine.

How to read the UFT API EndPoint value at runtime

For this example, I’m using the WSDL http://www.webservicex.net/geoipservice.asmx?WSDLand the GetGeoIP operation. In the GetGeoIP’s Properties>Events I created a custom handler under the OnBeforeExecuteStepEvent. To quickly test this out, I added a using System.Windows.Forms; under my using statements, then entered the following:

Leave a reply:

This is great for detecting a change in the endpoint. Is there a way to programmatically update the wsdl and store the wsdl with the updated script saving the time to manually update each script’s wsdl?

Leave a reply:

I have read your book “The UFT API Testing Manifesto” and is really good for every one who wants to work using API Test using UFT.

But I have one query which is even I could not find in your book. If I want to check httpStatusCode after response from web service whether web service has executed successfully or not how can I retrieve it. Is there any build in function for this.

Or if I have to write custom code can you please tell which class and method I can use.

And from where I can know about methods and classes of API Test in UFT.

and it works fine if the property is enabled. My Issue is if the property is disabled and if I have to set the value based on a condition at runtime (only if required) then the test fails because the property is disable.

Copyright text 2017 by Joe Colantonio/TestTalks br> br>Disclaimer All the contents of the Blog, EXCEPT FOR COMMENTS, constitute the opinion of the Author, and the Author alone; they do not represent the views and opinions of the Author’s employers, supervisors, nor do they represent the view of organizations, businesses or institutions the Author is a part of. Privacy Policy
- Designed by Thrive
Themes | Powered by WordPress