简体   繁体   English

在某些地方使用了[WebService(Namespace =“ http://tempuri.org/”)]?

[英]does [WebService(Namespace = “http://tempuri.org/”)] is used some where?

I have made a web service that returns names of countries. 我做了一个返回国家名称的Web服务。 What my web service returned was 我的网络服务返回的是

<ArrayOfString>
               <string>Australia</string>
               <string>USA</string>
               <string>UK</string>
</ArrayOfString>

Why we have [WebService(Namespace = "http://tempuri.org/")] ? 为什么我们有[WebService(Namespace = "http://tempuri.org/")]

I read it is on client side to distinguish nodes. 我读到它是在客户端区分节点。 This URL is also not location of web service. 此URL也不是Web服务的位置。

Is it has any use practically ? 实际上有什么用吗?

Web Services use namespaces to distinguish their types from the types of other services. Web服务使用名称空间将其类型与其他服务的类型区分开。 http://tempuri.org/ is a temporary (hence the name) namespace that should be replaced when put into a live environment. http://tempuri.org/是一个临时(因此为名称)名称空间,当放置到实时环境中时应将其替换。 Typically it would consist of a URI representing the source (ie your company's website URL) plus some other indicators to distinguish it from other services in your organization (eg http://www.haansi.org/Companies ). 通常,它由代表来源的URI(即您公司的网站URL)以及将其与组织中其他服务(例如http://www.haansi.org/Companies )区分开来的其他指示符组成。

From MSDN: MSDN:

An XML Web service should change its default XML namespace before it is made public. XML Web服务在公开之前应更改其默认XML名称空间。 Each XML Web service needs a unique XML namespace to identify it so that client applications can distinguish it from other services on the Web. 每个XML Web服务都需要一个唯一的XML命名空间来标识它,以便客户端应用程序可以将其与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. http://tempuri.org/可用于正在开发的XML Web服务,但是已发布的XML Web服务应使用更永久的名称空间。

Your XML Web service should be identified by a XML namespace that you control. 您的XML Web服务应由您控制的XML名称空间标识。 For example, you could use your company's Internet domain name as part of the XML namespace. 例如,您可以将公司的Internet域名用作XML名称空间的一部分。 Although many XML Web service XML namespaces look like URLs, they need not point to an actual resource on the Web. 尽管许多XML Web服务XML名称空间看起来像URL,但它们不必指向Web上的实际资源。 (XML Web service XML namespaces are URIs.) For XML Web services created using ASP.NET, the default XML namespace can be changed using Namespace property. (XML Web服务XML名称空间是URI。)对于使用ASP.NET创建的XML Web服务,可以使用Namespace属性更改默认的XML名称空间。

The http://tempuri.org is just a placeholder. http://tempuri.org只是一个占位符。 ie something text/markup/code that can be changed. 即可以更改的文本/标记/代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何隐藏名称空间 <string xmlns=“http://tempuri.org/”> 在网络服务? - How to hide the namespace <string xmlns=“http://tempuri.org/”> in webservice? 服务需要tempuri.org的名称空间 - Service expects namespace of tempuri.org Web服务中的http://tempuri.org/? - http //tempuri.org/ in Web services? 为什么WCF服务代理文件包含http://tempuri.org? - Why does WCF service proxy flie contain http://tempuri.org? 如何在WCF 4.5中完全更改tempuri.org命名空间 - How to completely change tempuri.org namespace in WCF 4.5 尝试序列化参数http://tempuri.org/:callback时发生错误 - There was an error while trying to serialize parameter http://tempuri.org/:callback ASMX Web服务 - “此Web服务使用http://tempuri.org/作为其默认命名空间。”消息 - 但它不应该是 - ASMX Web Service - “This web service is using http://tempuri.org/ as its default namespace.” message - but it shouldn't be 尝试序列化参数http://tempuri.org/:exception时发生错误。 在C#中 - There was an error while trying to serialize parameter http://tempuri.org/:exception. in C# 将Xml反序列化为对象时出错-{ <string xmlns='http://tempuri.org/'> 没想到。} - Error Deserializing Xml to Object - {<string xmlns='http://tempuri.org/'> was not expected.} WCF 服务保持 tempUri 命名空间 - WCF service keeps tempUri namespace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM