Forum Discussion

RichardM's avatar
RichardM
Occasional Contributor
13 years ago

Assertion with wildcards

I am trying to use and XPath Match assertion to check the content of an element in a soap response. I want to use a wildcard to check for any character.
The soap response is
   <soap:Body>
<GetDocumentBinaryResponse xmlns="http://sword-insurance.com/openplus/documentservice">
<Root>
<Document DocumentKey="166946" DocumentType="1" FileName="ITSD166946.doc">
<File>AAAAAAAAAAAAAAAAAAA+ejyj/no8o/56SKP+ekij/npUo/56VKP+emCj/npgo/56bKP+emyj/nqQo/56kKP+epyj/nqco/56qKP+eqij/nq0o/56tKP+etCj/nrQo/563KP+etyj/nr0o/569KP+egCk/noApP56IKT+eiCk/npEpP56RKT+emik/npopP56dKT+enSk/nqApP56gKT+eoyk/nqMpP56mKT+epik/nqkpP56pKT+erCk/nqwpP56vKT+eryk/nrIpP56yKT+etSk/nrUpP564KT+euCk/nr8pP56/KT+ehil/no=</File>
</Document>
</Root>
</GetDocumentBinaryResponse>
</soap:Body>

My assertion is an Xpath Expression with;

Declare;
declare namespace ns1='http://sword-insurance.com/openplus/documentservice';
//ns1:File[1]

Expected Result
*
Allow wildcards is checked.

However, the assertion fails, saying "XPathContains comparison failed, expecting
  • , actual was [AAAAA....
    Can anyone suggest what I am doing wrong?

    Richard
    • RichardM's avatar
      RichardM
      Occasional Contributor
      Thanks for the suggestion Rohit, but that just gives
      "XPathContains comparison failed, expecting [<ns1:File>*</ns1:File>], actual was [zxHgobEa4QAAAAAAAAAAAAAAAAAA...etc"
    • I guess we just missed out the namespace in the Expected result.
      <ns1:File>*</ns1:File>

      and also then check the "Ignore namespace". If it doesn't work, then kindly share the what you get on clicking the "Select from Current". There you can replace the result with *.

      Regards,
      {Pradeep Bishnoi}
      http://learnsoapui.wordpress.com
    • RichardM's avatar
      RichardM
      Occasional Contributor
      Thanks Pradeep,
      We have got there now!
      I have
      declare namespace ns1='http://sword-insurance.com/openplus/documentservice';
      //ns1:Document[1]
      for the declaration
      and (using the Select from current option and replacing actual values with wildcards)
      <Document DocumentKey='*' DocumentType='*' FileName='*' xmlns="http://sword-insurance.com/openplus/documentservice" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
      <File>*</File>
      </Document>


      I have Allow Wildcards checked and Ignore namespace prefixes unchecked (checking it gave another error).
      Thanks very much for your help

      Richard