Forum Discussion

Bryan_Nahrwold's avatar
Bryan_Nahrwold
Contributor
16 years ago

need to understand XPATH requires for a Property transfer

I have a soap response containing:


 
     
        <?xml version="1.0" encoding="UTF-8"?><br /><activationfile filename="en-activate.2008-07-16-18-41-55.txt"><br /><content><br /><activation isActivation="true" updateDateTime="2008-07-17 00:41:57"><br /><account contactPassword="*****" contactUserName="A201_5"/><br /><core deviceId="{0A10E657:011B2D681939:C99C:01812AB7}" machineName="SLC-BNAHR1-2K3E"><br /><attributes><br /><attribute name="Win32_PhysicalMemoryArray.1.MaxCapacity" value="8ea74146ff60bc24bc6aa9b7030477b03c3f57ae"/><br /><attribute name="Win32_BIOS.1.VersionNumber" value="8e861440496b85d97a5de1518d4d7111f5ce9d96"/><br /><attribute name="Win32_OperatingSystem.1.Product ID" value="659588371535bc0c1b518c4fa3ee991875cc34bc"/><br /><attribute name="Win32_PhysicalMemoryArray.1.Caption" value="e2a86fb5fea95c3f80e02f87179d1d8945473c6f"/><br /><attribute name="Win32_NetworkAdapter.1.MACAddress" value="3c4ed3d212f6f1b33bd209c1c467330894d8f9b2"/><br /><attribute name="Win32_NetworkAdapter.1.Caption" value="22bab4f1cca1da23016529ffe97453fde9d2f554"/><br /><attribute name="Win32_BIOS.1.Caption" value="0cb23d0fb35013be15ff0420ffa324f0d2ec59b0"/><br /><attribute name="Win32_ComputerSystem.1.Manufacturer" value="df6d0f41b14d90f12f4db5755265651fbe1d9423"/><br /><attribute name="Win32_Processor.1.Caption" value="d8f3cacecee929e3508c34e621760efd58e04ee9"/><br /><attribute name="Win32_OperatingSystem.1.Version" value="76b7228c8c021a517ffd85fa5b4b580c5a9523ad"/><br /><attribute name="Win32_ComputerSystem.1.Model" value="c84ab420ff6f7dd4792d9fd36bac5fe38319b5b3"/><br /><attribute name="Win32_ComputerSystem.1.Caption" value="de02b534d678b4293b470f7f63c41ff0c941e3e4"/><br /><attribute name="Win32_BIOS.1.Manufacturer" value="3bdcc88ddd25a2131613ba15ba192df90495858a"/><br /><attribute name="Win32_Processor.1.Manufacturer" value="3d4c8a665fae050f9e900f2a2ab4688be27b14d9"/><br /><attribute name="Win32_OperatingSystem.1.Caption" value="763f3096ead0824935a6da7ba404df99f6ed97e9"/><br /></attributes><br /><features><br /><feature id="74" version="2.0.1"/><br /><feature id="75" version="2.0.1"/><br /><feature id="73" version="2.0.1"/><br /></features><br /></core><br /></activation><br /></content><br /></activationfile>
     

 


I need ONE item from this file, but it is not wrapped in a tag.  It is in an attrbute:

The fifth tag contains:

I need the filename.  I submitted this once before but did not understand the response.  I believe I was told I needed a GRouovy script, but I have never seen anything on you site that helps me understand exactly what I DO to not only create the Groovy script, but tie it into my test case.

As I said, I have a Property Transfer called filename Property Transfer.
It contains a transfer called filename transfer. 
The source is the test step: activateLicenseand the property is Response
I created this text for the Transfer:
declare namespace ns1='http://http://ws.licensing.amp.avocent.com';
//ns1:activateLicenseResponse[1]/ns1:out[1]/ns1:activationfile[1]

The target is filename Property with a property of filename

The problem is that nothing is getting transferred by filename Property Transfer.

Thanks

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    problem here is that the XML you want to transfer from is wrapped in a CDATA block, meaning that it is not really viewed as XML by the XPath engine  but just as a string.. you need to do the following:

    1) Create a temporary property in your Properties Step names "tempXml" (or something..)
    2) In your PropertyTransfer step first create transfer that transfers the following source xpath from this response to your temporary property:

    declare namespace ns1='http://http://ws.licensing.amp.avocent.com';
    //ns1:activateLicenseResponse/ns1:out


    -> This should transfer the entire content of the out element to the tempXml property

    3) Create a transfer after this one that has the source set to the tempXml property (which can now be handled as XML instead of just a string withing another XML document) with the following source xpath:

    //activationfile/@filename


    and the target set to your filename property

    Does that help?

    regards!

    /Ole
    eviware.com