Forum Discussion

ThomasAu's avatar
ThomasAu
Contributor
14 years ago

Referencing an Endpoint?

Hello, I am a complete novice to automation and soapUI. (Today is my first time using it). I also have not touched any sort of scripting/programming in over 7 years, so please excuse my mistakes.

I am verifying the existance of some XML node. When the nodes don't have a namespace, such as:


<node1>
<node2>


I can easily use xpath:

exists(//node1)
or
exists(//node1/node2)


When there is a namespace, which can change, I am not sure how to handle it. I was thinking of doing a wildcard, but the following did not work:


declare namespace ns1='http://endpoint/dir1/dir2';
exists( //ns1:node1)


to


declare namespace ns1= '*';
exists( //ns1:node1)


After that did not work, I found that I could just ignore the namespace entirely by doing the following:


exists( //*[local-name()='node1'])


However, now I think I want to somehow reference the endpoint so that whenever I use different endpoints, I can verify the endpoint.

So, if my endpoint is http://endpoint:8080, how would I have done the previous by referencing this?

Lastly, if I can somehow reference the endpoint, how would I add the rest of the URI to the base endpoint, given that the rest never changes. Only the base endpoint does.

I would imagine it would be something like

declare namespace ns1=myEndpoint + "/dir1/dir2";
exists( //ns1:node1)



Thanks in advanced.

1 Reply

  • 22 views and nobody knows?

    Is this a difficult thing to do? If so, I will just stick with using the local-name.