Forum Discussion

BA_Service_Haus's avatar
BA_Service_Haus
Regular Contributor
15 years ago

QUERY_MATCH Mock Dispatch Mode - wrong expected value

Hi,

this problem was found with soapUI Pro 3.6.1.

When trying to create a Mock-Operation, using the dispatch mode "XQUERY" we met a problem.
First we let soapUI generate the XPath automatically.
After that we inserted the expected value.

But when running tests against this mock, all of them failed because the conditions never met.
During investigation I found out that soapUI generates an expected value different from the one I would expect (by clicking "Extract" in the "QUERY_MATCH" dialog). It always contains the whole xml-node (we would just expect its content).

e.g.:
expected: John
actual: <name xsi:type="xsd:string" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:def="http://DefaultNamespace">John</name>

We have seen this behaviour only for a certain service. For others, soapUI works correct.
Is this a problem of a (maybe bad implemented) service/wsdl or a problem of soapUI?

Best regards
Nico
  • Hi Nico,

    its hard to know from this description.. would it be possible for you to share your WSDL with us so we can try to reproduce?

    regards!

    /Ole
    eviware.com
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Ole,

    I attached the WSDL to this post.
    The Service was created for testing purposes only.

    Best regards
    Nico
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Ole,

    I want to add, that this problem can also be seen, when trying to save the xml-node content to a Data-Sink.
    Here I chose "SubReport" and added a new Property "Ergebnis". Into the value filed I inserted "${addiereVier#Response#declare namespace ns1='http://DefaultNamespace'; //ns1:addiereVierResponse[1]/ns1:addiereVierReturn[1]}" by using "GetData" in the context menu ( I chose the "Property [Response] of the certain request step.)

    Best regards
    Nico
  • Hi Nico,

    sorry for the delay on this; the reason for this behavior is that soapUI extracts the just the value only if there aren't any attributes; in your case there are a number of XSI-related attributes that will cause soapUI to extract them all. You could work around this by adding "/text()" to the generated XPath expression.

    We could change soapUI to ignore these specific namespaces, but that would have to be optional to not break any existing usage that relies on current behavior.

    Hope this helps!

    regards,

    /Ole
    eviware.com
  • BA_Service_Haus's avatar
    BA_Service_Haus
    Regular Contributor
    Hi Ole,

    that works great.
    In my opinion there is no need for a new option, as long as I can use /text() to get, what I want

    Thanks a lot for your help.
    And best regards
    Nico