cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional goto using "contains"

Highlighted
New Contributor

Conditional goto using "contains"

Hi,
I try to use conditional goto and the function contains. I try to validate a phone number but it does not work. It also seems as the function transfers 0 (zero) to O. Anyone got an idea how to do it - I'd rather not get into groovy script.

Example:
this is the line of code that does not work:
contains (//s:Body/ns1:GetUserDataMsg/Response/Telekom/phone, 222333444)
When I validate a word (like hello) it works, but when I try to do it with a number it does not work (no condition true..)
Cheers
Staffan
7 REPLIES 7
Highlighted
Super Contributor

Re: Conditional goto using "contains"

Hi Staffan,

hmm.. can you show the entire response message and the exact xpath expression you are using?

regards!

/Ole
eviware.com
Highlighted
New Contributor

Re: Conditional goto using "contains"

Hi,
the response is:

 
     
       

            Test
            2009-01-12T14:00:03
       

       
            Olle
            JOHANSSON
           
             
              Gatan 1
              666 66
              JÖNKÖPING
             
              2007-02-08
           

           
              Lampa
              GFAB
              433 33
              Göteborg
             
              2005-09-05
              2008-09-05
              2005-09-05
           

           
              031-3333232
              2009-01-12
           

       

     

 


And the xpath expression is
declare namespace ns1='http://Test.Service';
declare namespace ns0='http://Test.Service/HeaderV1R00';
declare namespace s='http://schemas.xmlsoap.org/soap/envelope/';
contains (//s:Body/ns1:GetUserDataMsg/Response/Telekom/phone, 031-333)

Br
Staffan
Highlighted
Super Contributor

Re: Conditional goto using "contains"

Hi Staffan,

it seems to me the namespace declarations in your xpath are incorrect, please try

declare namespace ns1='http://Test.Service/GetUDat';
declare namespace s='http://schemas.xmlsoap.org/soap/envelope/';
contains (//s:Body/ns1:GetUserDataMsg/Response/Telekom/phone, '031-333')

instead.

regards,

/Ole
eviware.com
Highlighted
New Contributor

Re: Conditional goto using "contains"

Hi,
I stripped the namespaces to hide the service I am working with. The namespaces etc are working and I succeed in getting a match when I use the text "hello" instead of a phone number.

Staffan
Highlighted
Super Contributor

Re: Conditional goto using "contains"

oh, ok.. 🙂

In that case, maybe you need to surround the value you are checking for with quotes? (in your example it seems these are missing...)

regards!

/Ole
eviware.com
Highlighted
New Contributor

Re: Conditional goto using "contains"

I tried but it doesn't help if I add quotes. Is there a way for me to print to the log the value that is extracted in the "contains" function?
/Staffan
Highlighted
Super Contributor

Re: Conditional goto using "contains"

Hi,

No logging possibility here unforunately..

hmm.. what if you append /text() to the xpath expression.. any difference?

regards!

/ole
eviware.com
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors