Forum Discussion

cevans's avatar
cevans
New Contributor
8 years ago

Using request body within QUERY_MATCH

I am building SoapUI mockOperations for use in a CI environment. The operations include updates as well as enquiries.

 

If I use a simple xpath statement to pull out a couple of values it works fine. eg.

XPath:

declare namespace NS1="http://schemas.xmlsoap.org/soap/envelope/"

declare namespace ser="http://service.portal.abc.com/"

concat(string(/NS1:Envelope/NS1:Body/ser:getStuff/arg0/keyId),

              '-',

              string(/NS1:Envelope/NS1:Body/ser:getStuff/arg0/refNumber))

 

Expected Value:

45689999-CL1013350245

 

In some instances the project needs a little better validation of the inbound request message so I amended these settings as follows to return the content of the message not just individual elements. Sometimes the inbound message will be much more complicted and this would be an easier way to 'validate' it.

XPath:

declare namespace NS1="http://schemas.xmlsoap.org/soap/envelope/"

declare namespace ser="http://service.portal.abc.com/"

/NS1:Envelope/NS1:Body/ser:getStuff/arg0/*

 

Expected Value:

<arg0 xmlns:ser="http://service.portal.abc.com/" xmlns:NS1="http://schemas.xmlsoap.org/soap/envelope/">

  <keyId>45689999</keyId>

  <refNumber>CL1013350245</refNumber>

</arg0>

 

This second method works fine. Then after restarting the mock service it stops working. If I update the expected value, but effectively make no change it starts working again!

I went to the extent of saving a copy of the project not working, amendning it so it worked again, saving and comparing the two project xml files and they were the same.

 

This looks like a product defect but I wanted to ask if anyone had any suggestions for a workaround that allows the request message to be checked, not just a couple of parsed values.

1 Reply

  • cevans's avatar
    cevans
    New Contributor

    After some further research I found that on exiting and reopening a soapui project that my query match line endings are bieng converted from CRLF to LF.

     

    Any suggestions how I can stop SoapUI from doing this?

     

    Or alternatively allowing me to make the same chaneg from CRLF to LF in the response message I am extracting using XPath?

     

    Thanks