100

Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique from any other on the web?

SpoiledTechie.com
  • 10,515
  • 23
  • 77
  • 100

5 Answers5

64

Unfortunately the tempuri.org URL now just redirects to Bing.

You can see what it used to render via archive.org:

https://web.archive.org/web/20090304024056/http://tempuri.org/

To quote:

Each XML Web Service needs a unique namespace in order for client applications to distinguish it from other services on the Web. By default, ASP.Net Web Services use http://tempuri.org/ for this purpose. While this suitable for XML Web Services under development, published services should use a unique, permanent namespace.

Your XML Web Service should be identified by a namespace that you control. For example, you can use your company's Internet domain name as part of the namespace. Although many namespaces look like URLs, they need not point to actual resources on the Web.

For XML Web Services creating[sic] using ASP.NET, the default namespace can be changed using the WebService attribute's Namespace property. The WebService attribute is applied to the class that contains the XML Web Service methods. Below is a code example that sets the namespace to "http://microsoft.com/webservices/":

C#

[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
   // implementation
}

Visual Basic.NET

<WebService(Namespace:="http://microsoft.com/webservices/")> Public Class MyWebService
    ' implementation
End Class

Visual J#.NET

/**@attribute WebService(Namespace="http://microsoft.com/webservices/")*/
public class MyWebService {
    // implementation
}

It's also worth reading section 'A 1.3 Generating URIs' at:

http://www.w3.org/TR/wsdl#_Toc492291092

Kev
  • 118,037
  • 53
  • 300
  • 385
47

Webservices require unique namespaces so they don't confuse each others schemas and whatever with each other. A URL (domain, subdomain, subsubdomain, etc) is a clever identifier as it's "guaranteed" to be unique, and in most circumstances you've already got one.

stakx - no longer contributing
  • 83,039
  • 20
  • 168
  • 268
Oddmund
  • 1,324
  • 12
  • 21
  • Every once in a while, you can have a situation where you're storing data from 2 (or more) sources in a single XML document (e.g. gathering info from multiple chemical manufacturers about a well-known substance) and being able to use namespaces for each manufacturer allows you to have the same Xml element tag e.g. `Hand Soap` and `Palmolive` and `Soft Soap` without collision, and with clarity where the data came from – bkwdesign Mar 08 '19 at 13:24
  • 2
    What is tempuri.org? – Mon May 19 '20 at 11:34
14

Probably to guarantee that public webservices will be unique.

It always makes me think of delicious deep fried treats...

Andrew Kennan
  • 13,947
  • 3
  • 24
  • 33
13

http://en.wikipedia.org/wiki/Tempuri

tempuri.org is the default namespace URI used by Microsoft development products, like Visual Studio.

Serafina Brocious
  • 30,433
  • 12
  • 89
  • 114
  • 9
    Given the size of the article, you might as well have quoted the entire thing. – Chris Charabaruk Oct 08 '08 at 01:09
  • 5
    tempuri.org isn't particular to Microsoft, it's actually described in the W3C notes on WDSL: http://www.w3.org/TR/wsdl#_Toc492291092 - "The base URI "http://tempuri.org/" can be used to construct a URI without any unique association to an entity" – Kev Oct 08 '08 at 01:13
  • For what it's worth it no longer seems to be the case that tempuri.org has any endorsement by w3.org (at least on that linked page) – Mikeb Jun 25 '18 at 13:26
7

Note that namespaces that are in the format of a valid Web URL don't necessarily need to be dereferenced i.e. you don't need to serve actual content at that URL. All that matters is that the namespace is globally unique.

Ates Goral
  • 137,716
  • 26
  • 137
  • 190