Awzar Tash
Awzar Tash

Reputation: 13

how do i parse this XML in soapui

First of all, i add a properties step with property name response, and i add transfer property step to transfer the response XML to response property in properties step. and here is the groovy Code i wrote to parse this XML and trying to retrieve the seesionId value.but im getting the seesionId null result. how do i do it?

def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
    def holder = groovyUtils.getXmlHolder("Properties#response")
    log.info "sessionId: " + holder.getNodeValue("//sessionId")
    log.info holder['//sessionId']

    OUTPUT:
    Wed Aug 12 10:50:58 GMT+04:00 2015:INFO:xml=<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soap:Body>
    <signInResponse xmlns="http://..../analyticalserver">
    <return xsi:type="authResponseEntryWrapper">
    <status>true</status>
    <dateTimeEnd>1409726051</dateTimeEnd>
    <sessionId>fab37e3a8e38a4981291bab0611fb8aad7af54a0</sessionId>
    </return>
    </signInResponse>
    </soap:Body>
    </soap:Envelope>

     Wed Aug 12 10:50:58 GMT+04:00 2015:INFO:SET sessionID: null

    why sessionID is null?

Upvotes: 0

Views: 823

Answers (1)

SiKing
SiKing

Reputation: 10329

Proper XML, such as a SOAP message, has namespaces. To just read a node, you would need:

holder.getNodeValue("//*:sessionId")

Upvotes: 1

Related Questions