Forum Discussion

Lakshmaiah's avatar
Lakshmaiah
New Contributor
12 years ago

How to Transfer the properties

Hello !!

I am trying to use the property Transfer option in the SoapUI 4.5.2. When it is simple XML response it is working fine.
I am just defining the namespace and and accessing the value by the index. for Example...

declare namespace ns1='http://xml.abcdef.com/CCPRRR_12_9_1A';//ns1:surname[1]

But I am facing problem when the same set of elements come at different levels. I tried different ways as suggested in the web. However it is ending up as mismatch in target. Please help to resolve this.

Here is the sample XML response I am refering. In this idSection is repeating at different levels. How to copy the values of primeId of this response. Please help me to give the text to be placed in the property transfer section.


XML Response

<soapenv:Body>
<PAXIDC_RECIdentificationReply xmlns="http://xml.abcdef.com/CRECRR_12_9_1A">
<customerLevel>
<customerDetails>
<paxDetails>
<surname>POLISETTI</surname>
<type>A</type>
</paxDetails>
<otherPaxDetails>
<givenName>LAKSHMAIAH</givenName>
</otherPaxDetails>
</customerDetails>
<uniqueCustomerId>
<idSection>
<referenceQualifier>UCI</referenceQualifier>
<primeId>241634180017BF5B</primeId>
</idSection>

</uniqueCustomerId>
<sourceIndicator>
<selectionDetails>
<option>REC</option>
</selectionDetails>
</sourceIndicator>
<recordLocator>
<reservation>
<companyId>AB</companyId>
<controlNumber>ZXFHON</controlNumber>
</reservation>
</recordLocator>

<productLevel>
<operatingFlightDetails>
<carrierDetails>
<marketingCarrier>XY</marketingCarrier>
</carrierDetails>
<flightDetails>
<flightNumber>745</flightNumber>
</flightDetails>
<departureDate>20130701</departureDate>
<boardPoint>NRT</boardPoint>
<offPoint>MNL</offPoint>
</operatingFlightDetails>
<productIdentifiers>
<idSection>
<referenceQualifier>DID</referenceQualifier>
<primeId>242044160000D93D</primeId>
</idSection>
</productIdentifiers>
</productLevel>
</customerLevel>
</PAXIDC_RECIdentificationReply>
</soapenv:Body>
</soapenv:Envelope>

6 Replies

  • nmrao's avatar
    nmrao
    Community Hero
    In your response sample, two matches are highlighted. What would you like to achieve after getting the values and do you need a specific value or list of values?
  • nmrao's avatar
    nmrao
    Community Hero
    Use xpaths like below to get the right values
    //ns:idSection[ns:referenceQualifier='UCI']/ns:primeId/text()

    //ns:idSection[ns:referenceQualifier='DID']/ns:primeId/text()
  • okcjosh's avatar
    okcjosh
    Occasional Contributor
    Rao,

    I believe what he may be asking is how to capture those values, then pass them to the next webservice call.

    For instance, in your code example using xpaths you stated:
    "Use xpaths like below to get the right values
    //ns:idSection[ns:referenceQualifier='UCI']/ns:primeId/text()

    //ns:idSection[ns:referenceQualifier='DID']/ns:primeId/text()"

    In your example the values of 'UCI' and 'DID' are hardcoded. How would he code that xpath to capture the value of those fields, assuming they are different values with each call?
  • Lakshmaiah's avatar
    Lakshmaiah
    New Contributor
    Dear Rao,

    Thank you very much it is working fine now. Before this also, I have tried the another way to transfer by giving the full path.

    declare namespace ns1='http://xml.abcdef.com/CRECRR_12_9_1A';//ns1:RECIDC_RECIdentificationReply[1]/ns1:customerLevel[1]/ns1:productLevel[1]/ns1:productIdentifiers[1]/ns1:idSection[1]/ns1:primeId


    Both are working fine and your way is simple. Thanks alot.

    One small query.. Suppose if I have repetetive items of both DID and UCI.. How should I write the script to copy both. For example.. Here in this case.. It is possible that for one Pax - one UCI and for each product (Flight), individual DID will exist.

    Pls help.

    Thanks
    Lakshmaiah
  • nmrao's avatar
    nmrao
    Community Hero
    You may add conditions to the xpath so that you would get unique value if you are looking that way.