Forum Discussion

Novosib's avatar
Novosib
Occasional Contributor
12 years ago

Trouble Extracting Element from response

I'm having trouble extracting element from the response. The following is the response:
<Response xmlns="https://llapiu4.servevirtual.net/AccountWCFRestService/AccountServiceHost.svc/AccountService">
<Header>
<RequestDatetime>03/08/2013 02:41:05 AM</RequestDatetime>
<RequestId>soupUI_5712703161</RequestId>
<ServeTransactionDateTime>03/07/2013 01:41:04 PM</ServeTransactionDateTime>
<ServeTransactionId>282812</ServeTransactionId>
</Header>
<Payload/>
<RequestType>OPEN_ACCOUNT</RequestType>
<StatusCode>90001</StatusCode>
<StatusDescription>System Internal Error</StatusDescription>
</Response>

I entered the following code as the script assertion point:

import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
def node = holder.getNodeValue("//RequestId")
def stream = messageExchange.responseContentAsXml.toString()
log.info node
log.info stream

Node value returned is 'null' but I'm expecting: soupUI_5712703161. What am I doing wrong?
Thanks for the help.

4 Replies