datafile4
datafile4

Reputation: 69

Log the actual data sent in the request in SoapUI

I have the request which uses in-line script:

<Req>
 <TransactionId>${= new Date().format("yyyy_MM_dd_HH_mm_ss_SSS")}</TransactionId>
</Req>

How can I log value of TransactionId or whole request?

Upvotes: 0

Views: 699

Answers (1)

Rao
Rao

Reputation: 21379

Create a Script Assertion for the same test step.

And add the below code to achieve the same i.e., logs the entire request:

log.info context.rawRequest

In order to get the TransactionId, you can parse the request and extract the value with below code:

def xmlRequest = new XmlSlurper().parseText(context.rawRequest)
def tId = xmlRequest.'**'.find {it.name = 'TransactionId'}?.text()
log.info "Transaction id sent in the request is: $tId"

Upvotes: 1

Related Questions