Automation Testing

UFT API How to Dynamically Get and Set a WebService EndPoint

By Test Guild
  • Share:
Join the Guild for FREE

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?WSDL
and 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:

string wsdl = this.StServiceCallActivity4.TransportProtocol.SOAPProperties.EndpointAddress;
System.Windows.Forms.MessageBox.Show(wsdl);

How to Programmatically Set the UFT API EndPoint Value

Using the same EndpointAddress method, you can also programmatically set the endpoint by doing the following:

this.StServiceCallActivity7.TransportProtocol.SOAPProperties.EndpointAddress = “http://joe”;

Of course, the test will fail if you run it because this is not a real endpoint for the web service — but it will quickly prove to you that the endpoint is changed at runtime.

Now, in the real world, you can read endpoints from a file, spreadsheet, or in custom code and set your WSDL endpoint. Cool – hope it helps.

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:

  • Read it on your PC or Mac (Kindle Cloud Reader)
  • Read it on your iPhone or iPad (iTunes App)
  • Read it on your Android (Kindle for Android)
  • Read it on your Blackberry (Kindle for Blackberry)

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

A bearded man with blue glasses and a black-and-white jacket smiles at a microphone in a studio setting.

About Joe Colantonio

Joe Colantonio is the founder of TestGuild, an industry-leading platform for automation testing and software testing tools. With over 25 years of hands-on experience, he has worked with top enterprise companies, helped develop early test automation tools and frameworks, and runs the largest online automation testing conference, Automation Guild.

Joe is also the author of Automation Awesomeness: 260 Actionable Affirmations To Improve Your QA & Automation Testing Skills and the host of the TestGuild podcast, which he has released weekly since 2014, making it the longest-running podcast dedicated to automation testing. Over the years, he has interviewed top thought leaders in DevOps, AI-driven test automation, and software quality, shaping the conversation in the industry.

With a reach of over 400,000 across his YouTube channel, LinkedIn, email list, and other social channels, Joe’s insights impact thousands of testers and engineers worldwide.

He has worked with some of the top companies in software testing and automation, including Tricentis, Keysight, Applitools, and BrowserStack, as sponsors and partners, helping them connect with the right audience in the automation testing space.

Follow him on LinkedIn or check out more at TestGuild.com.

  1. 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?

  2. Hi Joe ,

    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.

    Please answer above query.

    Thanks & Regards
    Sahil Chaudhary

  3. Joe Book WSDL which you mentioned in your book isn’t working.Can you please look into that?

  4. How to enable a Web Service Call Property Value at runtime and set a value?

    I am trying to set Web Service Call Property Value at runtime using C#

    this.StServiceCallActivity4.InputEnvelope.SelectSingleNode(“/*[local-name(.)=’Name’][1]”).InnerText=”Test”;

    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.

  5. Hi Joe,

    When we load WSDL file we get many properties and we have a LoadXML option could you please explain us that option

Comments are closed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

5 Top Model Context Protocol Automation Tools (MCP Guide 2025)

Posted on 04/09/2025

What is Model Context Protocol (MCP) Model Context Protocol (MCP) is an open ...

What is TDD (Test Driven Development)

Posted on 04/05/2025

What is Test-Driven Development (TDD)? Test-Driven Development is a software development approach that ...

The Best Open Source API Testing Tools for 2025

Posted on 04/01/2025

Here is my list of the best open source API testing tools for ...