Forum Discussion

nakurato's avatar
nakurato
New Contributor
12 years ago

QUERY_MATCH Inquiry

Hi, is there a way to use multiple comparator in QUERY_MATCH in Mock Services?
let say I want to query ID and Department. is it possible?

currently, it seems that I can only query using 1 condition.

declare namespace wxf='http://oracle.com/WXFormsMgmt.xsd';
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//wxf:ID[1]

is it possible to use this?
declare namespace wxf='http://oracle.com/WXFormsMgmt.xsd';
declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//wxf:ID[1] and //wxf:Department[1]

Thanks...
  • Hi nakurato,

    I am not sure whether we can able to use multiple comparator in XQUERY Match.
    But it can be done using groovy script.


    def xml = new XmlParser().parseText(mockRequest.requestContent)
    def wxf=new groovy.xml.Namespace("http://oracle.com/WXFormsMgmt.xsd")
    def soapenv=new groovy.xml.Namespace("http://schemas.xmlsoap.org/soap/envelope/")
    if (xml[soapenv.Body][wxf.ID] == "123") && xml[soapenv.Body][wxf.Department]=="HR")
    return "Response 1"
    else
    return "Response 2"

    Please let me know if you need more details

    Thanks & Regards
    Saravanan Ramamoorthy