What problems can occur when using the "http://tempuri.org/" namespace on our webservices?

Asked

Viewed 1,217 times

4

When creating a webservice, in my case using ASP.NET, I always change the default namespace to something related to my project, usually using the website URL for this.

But lately I have had the need to integrate systems and usually other developers have sent me the namespace "http://tempuri.org", what it means to me (temporary URI).

ASP.NET even warns of this, but I know that some developers simply ignore this warning.

Below an example of the alert, which says :

This web service is using http://tempuri.org/ as its default namespace.

Recommendation: Change the default namespace before the XML Web service is made public.

<html>

    <head><link rel="alternate" type="text/xml" href="/Clientes/IntegraBlueXCDCF.asmx?disco" />

    <style type="text/css">
    
		BODY { color: #000000; background-color: white; font-family: Verdana; margin-left: 0px; margin-top: 0px; }
		#content { margin-left: 30px; font-size: .70em; padding-bottom: 2em; }
		A:link { color: #336699; font-weight: bold; text-decoration: underline; }
		A:visited { color: #6699cc; font-weight: bold; text-decoration: underline; }
		A:active { color: #336699; font-weight: bold; text-decoration: underline; }
		A:hover { color: cc3300; font-weight: bold; text-decoration: underline; }
		P { color: #000000; margin-top: 0px; margin-bottom: 12px; font-family: Verdana; }
		pre { background-color: #e5e5cc; padding: 5px; font-family: Courier New; font-size: x-small; margin-top: -5px; border: 1px #f0f0e0 solid; }
		td { color: #000000; font-family: Verdana; font-size: .7em; }
		h2 { font-size: 1.5em; font-weight: bold; margin-top: 25px; margin-bottom: 10px; border-top: 1px solid #003366; margin-left: -15px; color: #003366; }
		h3 { font-size: 1.1em; color: #000000; margin-left: -15px; margin-top: 10px; margin-bottom: 10px; }
		ul { margin-top: 10px; margin-left: 20px; }
		ol { margin-top: 10px; margin-left: 20px; }
		li { margin-top: 10px; color: #000000; }
		font.value { color: darkblue; font: bold; }
		font.key { color: darkgreen; font: bold; }
		font.error { color: darkred; font: bold; }
		.heading1 { color: #ffffff; font-family: Tahoma; font-size: 26px; font-weight: normal; background-color: #003366; margin-top: 0px; margin-bottom: 0px; margin-left: -30px; padding-top: 10px; padding-bottom: 3px; padding-left: 15px; width: 105%; }
		.button { background-color: #dcdcdc; font-family: Verdana; font-size: 1em; border-top: #cccccc 1px solid; border-bottom: #666666 1px solid; border-left: #cccccc 1px solid; border-right: #666666 1px solid; }
		.frmheader { color: #000000; background: #dcdcdc; font-family: Verdana; font-size: .7em; font-weight: normal; border-bottom: 1px solid #dcdcdc; padding-top: 2px; padding-bottom: 2px; }
		.frmtext { font-family: Verdana; font-size: .7em; margin-top: 8px; margin-bottom: 0px; margin-left: 32px; }
		.frmInput { font-family: Verdana; font-size: 1em; }
		.intro { margin-left: -15px; }
           
    </style>

    <title>
	Meu WebService
</title></head>

  <b>

    <div id="content">

      <p class="heading1">Meu WebService de Exemplo</p><br>

      <span>
          <p class="intro"><h2>Minha descrição do WebService</h2></p>
      </span>

      <span>

          <p class="intro">The following operations are supported.  For a formal definition, please review the <a href="MeuWebService.asmx?WSDL">Service Description</a>. </p>
          
          
              <ul>
            
              <li>
                <a href="MeuWebService.asmx?op=MeuMetodoExemplo">MeuMetodoExemplo</a>
                
                <span>
                  <br>Descrição do MeuMetodoExemplo.
                </span>
              </li>
              <p>
            
              </ul>
            
      </span>

      
      

    <span>
        
    </span>
    
      <span>
          <hr>
          <h3>This web service is using http://tempuri.org/ as its default namespace.</h3>
          <h3>Recommendation: Change the default namespace before the XML Web service is made public.</h3>
          <p class="intro">Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. http://tempuri.org/ is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace.</p>
          <p class="intro">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 XML Web service namespaces look like URLs, they need not point to actual resources on the Web. (XML Web service namespaces are URIs.)</p>
          <p class="intro">For XML Web services creating using ASP.NET, the default namespace can be changed using the WebService attribute's Namespace property. The WebService attribute is an attribute 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/":</p>
          <p class="intro">C#</p>
          <pre>[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
    // implementation
}</pre>
          <p class="intro">Visual Basic</p>
          <pre>&lt;WebService(Namespace:="http://microsoft.com/webservices/")&gt; Public Class MyWebService
    ' implementation
End Class</pre>

          <p class="intro">C++</p>
          <pre>[WebService(Namespace="http://microsoft.com/webservices/")]
public ref class MyWebService {
    // implementation
};</pre>
          <p class="intro">For more details on XML namespaces, see the W3C recommendation on <a href="http://www.w3.org/TR/REC-xml-names/">Namespaces in XML</A>.</p>
          <p class="intro">For more details on WSDL, see the <a href="http://www.w3.org/TR/wsdl">WSDL Specification</a>.</p>
          <p class="intro">For more details on URIs, see <a href="http://www.ietf.org/rfc/rfc2396.txt">RFC 2396</a>.</p>
      </span>

      

    
  </body>
</html>

My question is this: Is namespace on our webservices something to worry about? I may have problems if I have to consume multiple webservices with the same namespace?

1 answer

5

There is a recommending where each service needs a namespace unique so that client applications can distinguish you from other web services.

http://tempuri.org is the URI test pattern used by Microsoft, like Visual Studio. It is available for Web Services which are under development, but Web Services published must use another namespace, with more significant URI in production systems.

That is, while you are developing the Web Service is good to leave as tempuri.org but do not forget to change this before publishing it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.