Forum Discussion

Bryan_Nahrwold's avatar
Bryan_Nahrwold
Contributor
16 years ago

Transfer portion of soapl response to popluate a soap request

How can I grab a specific element of a soap response of one teststep and use it in subsequent test requests?

I have a Teststep created from an operation the has the following response:


 
     
        <?xml version="1.0" encoding="UTF-8"?><br /><activationfile filename="en-activate.2008-05-19-16-20-06.txt"><br /><content><br /><activation isActivation="true" updateDateTime="2008-05-19 22:20:28"><br /><account contactPassword="*****" contactUserName="AMP20"/><br /><core deviceId="{0A10E657:011A022BA6D8:8AE0:0103AA37}" machineName="SLC-BNAHR1-2K3E"><br /><attributes><br /><attribute name="Win32_PhysicalMemoryArray.1.MaxCapacity" value="1ad96b19a500ee2b7195e7970f9997a3fc421619"/><br /><attribute name="Win32_BIOS.1.VersionNumber" value="a1f37ab70226c1fb04b7dfa19a4606c8d957a161"/><br /><attribute name="Win32_OperatingSystem.1.Product ID" value="36f1e8b461cf09af2f7d577ca991e2de5c381bb4"/><br /><attribute name="Win32_PhysicalMemoryArray.1.Caption" value="273096c9103f7b6c950a70c90cb5f25596473458"/><br /><attribute name="Win32_NetworkAdapter.1.MACAddress" value="0a6cb706a8b76c5bf1ce8c8afd5558710f967a57"/><br /><attribute name="Win32_NetworkAdapter.1.Caption" value="58e5b67ec2b7ed917f5ee2abb1b256b54523b5a3"/><br /><attribute name="Win32_BIOS.1.Caption" value="f5e0dda08bacf1cc43d6f2696a1961ca00630767"/><br /><attribute name="Win32_ComputerSystem.1.Manufacturer" value="e576997c9ab0793780bd7a0552be195a2144afa5"/><br /><attribute name="Win32_Processor.1.Caption" value="62c9f0e0f280c07018f56ebfceca1c1d29018ad8"/><br /><attribute name="Win32_OperatingSystem.1.Version" value="cfd228b23c653eb33df402033c735a86bcfe5ce8"/><br /><attribute name="Win32_ComputerSystem.1.Model" value="a3e3c480dc0c8c628831818e30883df81c66d04f"/><br /><attribute name="Win32_ComputerSystem.1.Caption" value="9ee5cdfc640b6a3b2412634b55436118311f66d5"/><br /><attribute name="Win32_BIOS.1.Manufacturer" value="0bb7f4e981bf5442ee99043ee05e0455967af6ca"/><br /><attribute name="Win32_Processor.1.Manufacturer" value="b773a08556b29493e2b2982dd161781b0accc94e"/><br /><attribute name="Win32_OperatingSystem.1.Caption" value="240b85b0253242f470618aae08d693e972567cc0"/><br /></attributes><br /></core><br /></activation><br /></content><br /></activationfile>
     

 


I need to be able to extract the activation filename from:


In this case, the next teststep needs:
en-activate.2008-05-19-16-20-06.txt
to go into:


 

 
     
        ?
     

 


I am at a loss for a way to do this.

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Bryan,

    Since the xml you want to get the value from is contained in a CDATA section, this becomes a bit tricky. What you can do is the following:

    1) Create a Property-Transfer Step between the two requests
    2) Create a Properties Step with one property named "tempvalue" (or whatever)
    3) In the Property-Transfer you will need to create two transfers:
    - The first should have the first Requests' response as source and transfer the content of the out element to the tempvalue property (be sure to uncheck the "Transfer Text Content" option)
    - The second should have this property as a source, together with the appropriate XPath for the filename, and the seconds Requests' request as target with the appropriate XPath for the actFileName element

    The first transfer copies the XML as a string to the property, the second treats it as XML (which is now possible) and transfers the desired value to the following request.

    Ok, hope this was understandable and that it works ok.. let me know!

    regards

    /Ole
    eviware.com
  • Thanks, Oli

    I'll give it a try next opportunity I have to work on this, possibly tomorrow.