Forum Discussion

cwlovell13's avatar
cwlovell13
Occasional Contributor
12 years ago

Help with Property Transfer

Hello,

I am trying to do a Property Transfer, but occasionally some of the field that I am transferring will be blank. Instead of returning NULL for blank fields SoapUI is returning the namespace info... Is there I can get it to return null?

Example of blank response:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<AddNewResponderResponse xmlns="http://testwebservices.com">
<AddNewResponderResult>
<Address2/>
</AddNewResponderResult>
</AddNewResponderResponse>
</soap:Body>
</soap:Envelope>


Example of what Property Transfer returns for //ns1:Address2

Mon Sep 23 15:16:28 PDT 2013 Address2 [<Address2 xmlns="http://testwebservices.com" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>]

6 Replies

  • nmrao's avatar
    nmrao
    Icon for Champion Level 1 rankChampion Level 1
    Would you please post the xpath used?
    May be if groovy script has more control (if you are comfortable) than the current way in that case, I believe.
  • cwlovell13's avatar
    cwlovell13
    Occasional Contributor
    Yes, I am just using simple XPath... Not good with Groovy yet, but just picked up a book on it so maybe I can find something in there...

    declare namespace ns1='http://testwebservices.com';
    //ns1:Address3
  • cwlovell13's avatar
    cwlovell13
    Occasional Contributor
    Yes 'Set Null on missing source' is checked.

    If I can't get this working can you point me in the direction of some materials that will help me write some groovy code that will parse the XML response and assign the non-null returns to variables?

    Thanks!
  • cwlovell13's avatar
    cwlovell13
    Occasional Contributor
    Thanks! Got this working via Groovy Script instead.


    def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder( "AddNewResponder - Request 1#Response" )

    def address3 = null

    holder.namespaces["ns1"]= "http://staging.rcws.hackergroupwebservices.com"

    if (holder.getNodeValue("//ns1:Address3") != null){

    address3 = holder.getNodeValue("//ns1:Address3")
    testRunner.testCase.setPropertyValue( "Address3", address3.toString())

    }
    else {

    testRunner.testCase.setPropertyValue( "Address3", address3)

    }