Highlighted
Absent Member.
Absent Member.
3010 views

UFT API: Save Response as xml

Jump to solution

Hi,

Is it possible to save the xml response automatically?

It's mean when I send a http-Request and I receive the response, i'd like to save this response directly into C:\Response.xml.

I tried this:

GetDataSource("TestName!Result").Export(@"C:\Users\xxxx\Desktop\response.xml");

but it doesn't work.

Thank you

0 Likes
1 Solution

Accepted Solutions
Highlighted
Super Contributor.
Super Contributor.

Re: UFT API: Save Response as xml

Jump to solution

Hi,

 

In Api Tests/Components you can do this by simply using the standard activities available. 

In the Toolbox menu, under 'Standard Activities' expand the 'File' list and add the 'Write to File' activity to your flow. Then, in the Input/Checkpoints tab of the activity you can set the export path (in the path you should include the name.xml file that will be generated) and the content (for the content you can select the main tag of the response, that holds all the content : <body> for example).

See the attached screenshot for more info.

 

Hope this helps!

 

 

Accept as solution and give kudos to the author if the information helped you solve your problem.

View solution in original post

3 Replies
Highlighted
Super Contributor.
Super Contributor.

Re: UFT API: Save Response as xml

Jump to solution

Hi,

 

In Api Tests/Components you can do this by simply using the standard activities available. 

In the Toolbox menu, under 'Standard Activities' expand the 'File' list and add the 'Write to File' activity to your flow. Then, in the Input/Checkpoints tab of the activity you can set the export path (in the path you should include the name.xml file that will be generated) and the content (for the content you can select the main tag of the response, that holds all the content : <body> for example).

See the attached screenshot for more info.

 

Hope this helps!

 

 

Accept as solution and give kudos to the author if the information helped you solve your problem.

View solution in original post

Highlighted
Absent Member.
Absent Member.

Re: UFT API: Save Response as xml

Jump to solution

Thank you very much!   it works

0 Likes
Highlighted
New Member.

Re: UFT API: Save Response as xml

Jump to solution
I have created a API test in which I have passed a API link but I am not able to get the response body in text.
I have tried that but I am not able to select <body> in content dropdown and not able to see the response in XML file that is created.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.