I tried to use script assert for json response in SoapUI but Error comes
"Lexing failed on line: 1, column: 1, while reading '<', no possible valid JSON value or punctuation could be recognized."
Request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://localhost">
<soapenv:Header/>
<soapenv:Body>
<loc:GetRoomAttribute>
<loc:countryId>123</loc:countryId>
<loc:locationId>36</loc:locationId>
<loc:roomId>213</loc:roomId>
</loc:GetRoomAttribute>
</soapenv:Body>
</soapenv:Envelope>
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>
<GetRoomAttributeResponse xmlns="http://localhost">
<GetRoomAttributeResult>{"roomAttribute":{"EndPointType":"SR","GroupId":23,"RegionId":22,"Occupancy":6}}</GetRoomAttributeResult>
</GetRoomAttributeResponse>
</soap:Body>
</soap:Envelope>
Script Assertion:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
assert json.roomAttribute.EndPointType == "SR"
How to Assert the 'EndPointType','GroupId','RegionId','Occupancy'
using script assertion with JsonSlurper
class.