开发者

Are WCF Namespaces Ever Called?

开发者 https://www.devze.com 2023-03-06 03:28 出处:网络
I have noticed that WCF namespaces are usually URLs, but if you try to access them in a browser they typically return 404.

I have noticed that WCF namespaces are usually URLs, but if you try to access them in a browser they typically return 404.

1) Are these namespaces ever really called?

2) If not, then why开发者_如何学Go are they URLs?

3) Do they have to be URLs or would any string do?

An example of what I've seen:

[ServiceContract(
    Name="ServcieAContract", 
    Namespace = "http://www.thatindigogirl.com/samples/2006/06")]
public interface IServiceA


The use of URIs for WCF namespace names is a convention which grew up around XML namespaces generally.

A namespace name can be any string, but the motivation for using a URI instead is that it is more likely (if chosen sensibly) to be globally unique - the host name part associates the namespace to a particular organisation, and that organisation should then have a standard for constructing unique namespace names within its domain.

In some cases the URI chosen is actually a URL: that is, a resource is obtainable from that address - usually documentation, or a copy of the schema, or such like. You might consider doing this if the namespace relates to some public interface and you want your customers to be able to easily find help/documentation on its usage.


Namespaces are just name *spaces*. They are not URLs.

Having said that sometimes Schemas are accessible in the URL.

can they be just normal strings? Absolutely. Although you would usually prefix them with urn: in this case.


As Chris commented, for URN specification see ietf.org/rfc/rfc2141.txt


1) They are not supposed to be called (although they may be, maybe for showing documentation) but are used to identify and versioning of the services and operations.

http://msdn.microsoft.com/en-us/library/ms733832.aspx

2) Check Chris Dickson answer

3) Any string would do but people mostly stick to the the label format with date-stamped namespace version

http://www.ibm.com/developerworks/xml/library/x-tipnamsp/index.html

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号