Gilbert_Pilz
13 years agoNew Contributor
XML translation of JSON is arbitrarily namespace qualified
Then I use soapUI to GET a resource with a JSON representation, the XML translation of that representation gets a default XML namespace that corresponds to the URL of the resource. For example:
<Response xmlns="http://fooble.example.com/campSrv/ApplicationComponentTemplate/13">
If you are trying to test a HATEOS-oriented service that uses arbitrary URLs (i.e. URLs that can change with every restart of the service), namespace qualifying the XML in this manner makes writing test scripts very difficult. I can't know, a priori, what the namespace of the response is going to be so writing XPATH expressions against this response is difficult. You have to use XPATH functions to work around the fact that you don't know the namespace URI, like so:
Needless to say, this is quite cumbersome and, though I'm not sure yet, probably has some limitations that you wouldn't see if the response were qualified with a knowable namespace URI.
<Response xmlns="http://fooble.example.com/campSrv/ApplicationComponentTemplate/13">
If you are trying to test a HATEOS-oriented service that uses arbitrary URLs (i.e. URLs that can change with every restart of the service), namespace qualifying the XML in this manner makes writing test scripts very difficult. I can't know, a priori, what the namespace of the response is going to be so writing XPATH expressions against this response is difficult. You have to use XPATH functions to work around the fact that you don't know the namespace URI, like so:
//*[local-name() = 'href' and ../../.[local-name() = 'applicationComponents'] and (../*[local-name() = 'name' and contains(text(), 'sample') ] ) ]
Needless to say, this is quite cumbersome and, though I'm not sure yet, probably has some limitations that you wouldn't see if the response were qualified with a knowable namespace URI.