-1

like the title says, I am wondering if for example I send an endpoint some XML with the namespace being: 'http://www.external.com/customNS', would the receiving end fetch that namespace? I think logically the answer is yes (unless there are rules that prevent fetching from external sources) but I need to verify this.

Question 2: just in case the answer is yes for the first question, reason I am asking is I have a task dealing with Onvif at work, which uses XML to send commands to IP cameras, and when the onvif XML namespace servers went down (Dec/28), some requests started failing, but I need to make sure this was the cause instead of faulty requests, so do you think cameras actually have the namespaces pre-loaded, and do absolutely no external fetching, or do they just fetch them on at least the first time a request with the specific namespace is received? I tried creating a server, and sending it to the camera as a namespace, but I didn't receive any requests, but this might just mean that the camera rejects requests with servers that aren't onvif's.

Example request I send to the camera (without header and footer):

<GetServiceCapabilities xmlns="http://www.onvif.org/ver20/ptz/wsdl" />
Thabet Sabha
  • 141
  • 1
  • 7

1 Answers1

1

would the receiving end fetch that namespace?

No.

Namespaces are strings. Their purpose in life is to be unique within the document, that's all.

That it's possible to use URLs as namespaces, and then set up a web server that gives more information at that URL is a bonus. There is no requirement for that, there is no technical definition of what kind of data has to be at such a URL, and the XML parser does not need it to do its job.

There might be other things (XML schemas, external DTDs, maybe XLink/XInclude) that could trigger requests during parsing or handling of the document, but namespace URIs definitely won't.

Tomalak
  • 332,285
  • 67
  • 532
  • 628
  • So, all the namespaces need to be defined on the server beforehand, and in the example I gave above, we are just mapping the url to the namespace? – Thabet Sabha Jan 09 '22 at 10:45
  • @ThabetSabha ...huh? From which sentence in my answer do you derive the statement *"all the namespaces need to be defined on the server beforehand"*? My answer **literally** says the opposite. – Tomalak Jan 09 '22 at 10:47
  • first of all, thanks for taking the time to answer this, I think I'm probably misunderstanding something, let's say that I am sending my requests with namespace: "http://www.onvif.org/ver20/ptz/wsdl", the server needs to know how to handle requests for this particular namespace, Reading your answer I was under the impression that the way this is done is that the server should know how to handle each namespace beforehand, so client and server in this particular case need to agree on the namespaces before. – Thabet Sabha Jan 09 '22 at 11:21
  • PS. I thought in the initial question, before reading your answer, that the receiving end will fetch the wsdl file – Thabet Sabha Jan 09 '22 at 11:29
  • @ThabetSabha ...and I said that it won't. It's completely irrelevant if there is anything is at the URL `http://www.onvif.org/ver20/ptz/wsdl`, the XML parser does not care. – Tomalak Jan 09 '22 at 11:33
  • *"Reading your answer I was under the impression that the way this is done is that the server should know how to handle each namespace beforehand"* - Which of the sentences I wrote implies that? I said "namespaces are strings". There is nothing to "handle". They are strings. Nothing more. – Tomalak Jan 09 '22 at 11:34
  • while the xml parser doesn't care about the namespace itself, wouldn't the server need to map that particular namespace to a handler function, so if I receive a getName where the namespace is 'Person', the Server needs to fetch the name from the Person table, where as getName from 'Animal', It needs to fetch the name from the Animal table, and so on. I meant in my first comment that the namespaces the server receives should be agreed upon before hand, other wise if I send a getName where the namespace is 'Person' the server will not correctly handle the request. – Thabet Sabha Jan 09 '22 at 14:42
  • 1
    @ThabetSabha I believe you're mixing up things here. Why would the server map namespaces to a handler function? The usefulness of namespaces begins and ends with being able to differentiate between a `` and a ``. The strings `"foo"` and `"bar"` are different, therefore those are not the same kinds of ``. That's it. There is no further magic involved. There is no lookup, no resolution, no handling, nothing. Whether `"foo"` actually resembles a URL is not relevant at all. – Tomalak Jan 09 '22 at 14:52