How to use Query_Match for the user interface for soap

I'm having problems using the MockOperation editor in the Soap UI.

I have this query:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> <s:Body> <methodName xmlns="http://tempuri.org/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <dataAreaId>error</dataAreaId> <pInvoiceList> <dataAreaId>NOTTHESAME</dataAreaId> ... </pInvoiceList> </methodName> </s:Body> </s:Envelope> 

I tried almost every XPATH expression, but always get "No match in request"

What to fill in the Xpath field?

I tried:

  • // dataAreaId / text ()
  • // dataAreaId /
  • // dataAreaId
  • / dataAreaId / text ()
  • / dataAreaId
  • / MethodName / dataAreaId / text ()
  • / MethodName / dataAreaId /
  • / name Method / dataAreaId
+7
source share
4 answers

I finally managed to get it based on the response from user1740631

It seems I dealt with namespaces after.

The correct syntax is:

 declare namespace tem='http://tempuri.org/'; //tem:methodName/tem:dataAreaId[1] 
+11
source

Write like this

For the first

// MethodName [1] / dataAreaId [1]

For the second

// MethodName [1] / pInvoiceList [1] / dataAreaId [1]

* If you have multiple nodes with the same name in Xml, you must use numbers to find this particular node.

+4
source

If you do not need namespaces, you can use the following syntax:

XPath1.0

 //*[local-name() = 'methodName']/*[local-name() = 'dataAreaId'][1] 

XPath2.0

 //*:methodName/*:dataAreaId[1] 
+2
source

There is a good hint: when defining a statement for a test system (or, possibly, also in the pop-up window), the "Declare" button appears above the XPath-Expression field. Actually, it doesn’t look like a button until you point the mouse at it, so I didn’t understand it at first.

Just click the SoapUI button (I actually use 5.2.1) will add declarations for you that you can use.

I found this function by coincidence, since it is not visible. Perhaps this will help too ...

0
source

All Articles