Forum Discussion

shiva's avatar
shiva
Occasional Contributor
17 years ago

xpath assertion fails

Hello,

  Iam newbie to wsapi testing and iam using SOAPUI2.0.2-pro.

I created an xpath assertion to one of my request with allow wildcards,

iam pasting my request, xpath expression and expected result and the error.


Request





${username}
${password}



 
     
       

 

    root
    1265033720000
SC2
    1
desc update
1265033720000
open
windows_3.1
all
p2
subcomponent_1
Summary update
b2
component_2
wsapitestuserupdate
wsapitestuserupdate
wsapitestuserupdate
   

 

  true


 


Xpath Expression
=============

declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/';
//soapenv:Envelope[1]

Expected
=======

 
   
     
       
          root
          *
          root
          *
          SC2
          1
          desc update
          1265011200000
         
            open
         

         
            windows_3.1
         

         
            all
         

         
            p2
         

         
            subcomponent_1
         

          Summary update
         
            b2
         

         
            component_2
         

         
            wsapitestuserupdate
         

         
            wsapitestuserupdate
         

         
            wsapitestuserupdate
         

         
            wsapitestuserupdate
         

         
            wsapitestuserupdate
         

         
            wsapitestuserupdate
         

       

       
     

   

 


when i click test iam getting the following error
Error:
XPathContains assertion failed for path [declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; //soapenv:Envelope[1]] : RuntimeException:net.sf.saxon.trans.StaticError: XPath syntax error at char 1 on line 2 in { declare namespace ns1}: Unexpected token "declare namespace" in path expression


i really need to sort out this,  i got very less time can any one help me

Regards,
senny.

4 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    hmm.. please try restricting your comparison to the body of the message;

    - change the xpath to //soapenv:Envelope[1]//soapenv:Body[1]
    - change the expected content to "start with" the Body element (instead of the Envelope)

    Let me know if this helps!

    regards,

    /Ole
    eviware.com
  • shiva's avatar
    shiva
    Occasional Contributor
    Hi Ole,
      I tried what you suggested but it dint help as such...
    pasting the assert failure message. Can you help me sort out this please

    XPathContains assertion failed for path [declare namespace soapenv='http://schemas.xmlsoap.org/soap/envelope/'; //soapenv:Envelope[1]//soapenv:Body[1]] : RuntimeException:net.sf.saxon.trans.StaticError: XPath syntax error at char 1 on line 2 in { declare namespace ns1}: Unexpected token "declare namespace" in path expression

    Regards,
    Senny.
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Senny,

    hmm.. would it be possible for you to mail me the WSDL containing this operation so I can try to reproduce this locally? (ole@eviware.com)

    Thanks in advance!

    /Ole
    eviware.com