Explain advanced assertions and provide an example scenario.

Advanced assertions in SOAP UI validate web service responses beyond basic checks. Types include XPath Match, XQuery Match, JSONPath Match, Schema Compliance, and Script Assertion.

Example Scenario :

Suppose you have a web service that returns user information in XML format. You want to validate that the response contains a user with a specific ID and that the user’s email address matches a certain pattern.
<Users>
  <User>
    <ID>123</ID>
    <Name>John Doe</Name>
    <Email>john.doe@example.com</Email>
  </User>
  <User>
    <ID>456</ID>
    <Name>Jane Smith</Name>
    <Email>jane.smith@example.com</Email>
  </User>
</Users>?


To achieve this, you can use an XPath Match assertion:
//User[ID='123']/Email[text()='john.doe@example.com']?

This XPath expression checks that there is a User element with an ID of 123 and that the Email element within that User element has the value “john.doe@example.com”.