我正在尝试从 XML 响应中存储 uuid“EnquiryId”的值。我相信标准方法是使用 xpath,但我没有正确使用它并收到“java.util.NoSuchElementException: key not found: enquiryId”
响应示例:
<created_enquiry xmlns="http://www.test.com/energy-rest-enquiry.xsd">
<enquiry_id id="1705230d-a64d-f075-e477-b11c3dabfa9c" link="value"/>
</created_enquiry>
代码示例:
http("REST Users Post Submit Enquiry")
.post("/rest/enquiry/enquiry")
.headers(headersREST)
.body(ELFileBody("RestSubmitEnquiry.xml"))
.check(status.is(201))
.check(xpath("/*/enquiry_id/@id").saveAs("enquiryId"))
谢谢