confusion of using URL's as namespace names. My company is an IT training
biggest source of confusion. But, once you get your head around the idea,
"cj" <cj@nospam.nospam> wrote in message
news:OBkDFLFWIHA.748@TK2MSFTNGP04.phx.gbl...
> Thanks very much Scott. That's the kind of explanation I wish I had on so
> many things. Honestly I think if the standard for web service namespaces
> was ACME/employees/HR instead of
http://www.ACME.com/employees/HR it
> would have made more sense to me as it doesn't carry the connotation that
> it's a web address. I would have understood it much quicker and I'm
> probably not the only person who finds it confusing. But that's ok. Now
> that I understand it's fine.
>
> BTW, I went to a Microsoft Seminar and the speaker said he wasn't going to
> talk about AJAX since unless we had been living under a rock for the past
> 3 years we already knew about that. Hey I use AJAX all the time on my
> kitchen counters! Of course with my great understanding of the lingo the
> seminar went quite well. ;)
>
> Well I've got to go put some things in order now. Oh, sorry, I mean I've
> go to marshal some things now.
>
> Thanks again,
> CJ
>
>
> Scott M. wrote:
>> "cj" <cj@nospam.nospam> wrote in message
>> news:eaqL%23H7VIHA.4440@TK2MSFTNGP06.phx.gbl...
>>> Yes, that helps. Making a namespace look like a web address is just
>>> asking for confusion IMHO but that's life.
>>
>> What you need to understand is that using what looks like a URL for a
>> namespace name is not directly related to .NET at all and is also not
>> done just for web service use.
>>
>> It is an XML standard per the World Wide Web Consortium (the W3C). The
>> reason for needing namespaces in XML is because the very nature of XML
>> allows you to make up tag and attribute names yourself based on the data
>> you will be passing. If 2 departments within a single company were to be
>> using XML to represent employee data (for just their department), they
>> each might inadvertently use the same tag names and/or attribute names.
>> Now, if those two lists of XML were to get mixed up, it would be very
>> hard to separate who's data is who's - - namespaces are needed to prevent
>> this from occuring (because although the tag names might be the same, the
>> xmlns="" value would be different).
>>
>> Now, you may ask "Ok, that makes sense, buy why use URL's and not some
>> other identifier?". Well, what if the two departments were "Human
>> Resources" and "Accounts Payable", couldn't they just use "HR" and "AP"
>> as the namespace names? Perhaps, but what happens if this company were
>> to merge with another company who is also using XML for just the same
>> purpose and that company is most likely going to have Human Resources and
>> Accounts Payable departments as well. If the two companies had been
>> using "HR" and "AP" as their namespace qualifiers, there would be no way
>> to tell who's data was who's.
>>
>> This is why namespaces are generally specified using URL's, because each
>> company/organization on the planet is guaranteed to have a unique URL and
>> so in the first senario above, the namespaces could be:
>>
>>
http://www.ACME.com/employees/HR >>
http://www.ACME.com/employees/AP >>
>> And, those namespaces would keep, not only those two departments XML data
>> separate, but when the new company gets merged with ACME, we still can
>> keep it all straight because the new company's namespaces would look like
>> this:
>>
>>
http://www.OtherCompany.com/employees/HR >>
http://www.OtherCompany.com/employees/AP >>
>>> So what I'm still wondering is why would it matter if you and I both use
>>> the same namespace--or would it? It's not actually telling the client
>>> where to send the request is it?
>>
>> No. Again, namespaces are not actually resolved by any software, they
>> just serve as names to group related XML data. As in my example above,
>> it could be very confusing if your data and my data got mixed up.
>> Namespaces are not required in all uses of XML because sometimes making
>> "groups" of XML isn't really necessary, but with web services, they are
>> because there are many services out there and different services can
>> still result in similar XML, so we need to keep each service's XML
>> separate from another's.
>>
>>> Does the client know the namespace before it calls the service?
>>
>> Yes. The proxy classes that are built by Visual Studio (usually hidden
>> files in the Solution Explorer) will have knowledge of the service
>> namespace.
>>
>>> Perhaps it does and then it waits for a response to come that says it's
>>> from that web service.
>>
>> No. Again, namespaces are just strings that identify a group of XML.
>> They aren't used in web services in this way.
>>
>>> In which case it wouldn't matter if both of us used the same namespace
>>> as long as a client wasn't requesting data from both of us in which case
>>> it would get confused on responses.
>>
>> True, but your missing the bigger point. Although it *may* not cause a
>> problem if two entities use the same namespace, the fact is that it
>> *could* and to eliminate the possibility, we make sure that different
>> services use different namespaces. It's more of a programming standard
>> than a programming issue.
>>
>> -Scott
>>
>>>
>>> Scott M. wrote:
>>>> A "namespace" looks like a URL, but it is not. In this case "tempuri"
>>>> stands for "temporary URI", meaning that it is dummy data that you are
>>>> supposed to change.
>>>>
>>>> Namespaces are used in XML (which is the format that your web service
>>>> sends/receives data) to organize/group XML tags and attributes. This
>>>> is conceptually the same as how namespaces are used in .NET - - to
>>>> organize/group classes. The difference being that in .NET, the syntax
>>>> uses dot notation (i.e. System.Web.UI) and in XML, namespaces use URI
>>>> (uniform resource indicators), such as "http://www.something.com".
>>>> Although they look like URL's, they are not and they are not meant to
>>>> be resolved - - they are just names that you make up to keep your XML
>>>> tags and attributes used by your web service organized and marked as
>>>> belonging to you.
>>>>
>>>> Generally, an XML namespace should start with the ACTUAL URL of your
>>>> company/organization, but again, not so that they can be browsed to,
>>>> but because it is highly unlikely that anyone else on the planet would
>>>> start their XML namespaces with your company/organization URL. After