473,614 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Namespaces in Vs.net 2005 web service

You know they say there is no such thing as a dumb question? This
might be the exception...I'm not sure. :)

In VS.NET 2003, if you create a web service it is namespaced like so:

namespace WebService156
{
...
}

If you do the same thing in VS.NET 2005, there is no namespace. I do
see something like this though:

[WebService(Name space = "http://tempuri.org/")]

That isn't the equivalent is it? If not, where did the namespace go
in 2005? I know in Windows apps they have it hidden in a separate
file (because they can do that with partial classes). But I see
nothing like that in the web service.

If there is no namespace any more for web services, how did they get
around the issue of having an app reference two web services with the
same class (i.e. two web services with a "Customer" class)?

Apr 4 '07 #1
8 2821
"Doogie" <dn******@dtgne t.comwrote in message
news:11******** **************@ b75g2000hsg.goo glegroups.com.. .
You know they say there is no such thing as a dumb question? This
might be the exception...I'm not sure. :)

In VS.NET 2003, if you create a web service it is namespaced like so:

namespace WebService156
{
...
}

If you do the same thing in VS.NET 2005, there is no namespace. I do
see something like this though:

[WebService(Name space = "http://tempuri.org/")]

That isn't the equivalent is it? If not, where did the namespace go
in 2005? I know in Windows apps they have it hidden in a separate
file (because they can do that with partial classes). But I see
nothing like that in the web service.

If there is no namespace any more for web services, how did they get
around the issue of having an app reference two web services with the
same class (i.e. two web services with a "Customer" class)?
These two things called namespaces are two different things.

The namespace WebService156 {} is a C# namespace. It creates a scope for the
names of types declared within it. For instance:

namespace WebService156
{
public class Foo {}
}

The full name of class Foo is WebService156.F oo.

The [WebService(Name space = "http://tempuri.org/")] is an XML namespace.
When a WSDL file is generated from your web service, the targetNamespace
will be http://tempuri.org. This provides a scope for the names of types
declared within the WSDL file. For instance, if there were a <wsdl:message >
declaration for a message named "foo", then the qualified (full) name of foo
would be http://tempuri.org:foo.

BTW, the http://tempuri.org is only a placeholder. You should create your
own unique namespace scheme. You needn't use a URL for the namespace,
either. You might try something like:
urn:service.app lication.busine ssDomain.compan y.com.

John
Apr 4 '07 #2
Hi John,

I knew most of what you are saying. My question though is that in
Vs.net 2005 I cannot see a "namespace WebService156" anywhere. It's
as if the web service has no namespace. In vs.net 2003 it's there, in
vs.net 2005 it's not. So I'm curious as to where it might be (in a
file I'm not seeing, etc.)

Apr 4 '07 #3
"Doogie" <dn******@dtgne t.comwrote in message
news:11******** **************@ n76g2000hsh.goo glegroups.com.. .
Hi John,

I knew most of what you are saying. My question though is that in
Vs.net 2005 I cannot see a "namespace WebService156" anywhere. It's
as if the web service has no namespace. In vs.net 2003 it's there, in
vs.net 2005 it's not. So I'm curious as to where it might be (in a
file I'm not seeing, etc.)
If you don't see it, then it isn't there.

John
Apr 4 '07 #4
If you don't see it, then it isn't there.
Then my next question still remains. Does this mean that in VS.NET
2005 they don't have namespaces for a web service?

If there is no namespace any more for web services, how did they get
around the issue of having an app reference two web services with the
same class (i.e. two web services with a "Customer" class)?
Apr 5 '07 #5
"Doogie" <dn******@dtgne t.comwrote in message
news:11******** **************@ y66g2000hsf.goo glegroups.com.. .
>
>If you don't see it, then it isn't there.

Then my next question still remains. Does this mean that in VS.NET
2005 they don't have namespaces for a web service?

If there is no namespace any more for web services, how did they get
around the issue of having an app reference two web services with the
same class (i.e. two web services with a "Customer" class)?
It would only mean that VS.NET, when you create a new web service, doesn't
necessarily put it into a namespace. You could put it into a namespace if
you wanted.

Also, server namespaces have nothing at all to do with the client. The
client refers to proxy classes, not to the server classes. The namespace for
proxy classes is generated based on the name specified in the Add Web
Reference dialog.

John
Apr 5 '07 #6
Hi John, I am still confused. I understand the difference between
client/server namespaces. But take out the fact that we're talking
about a web service altogether here and let's just deal with the fact
that it is a .NET dll.

If I have a windows application in .NET and I reference two dlls and
they both happened to have a class name of Customer, without the
unique namespace attached to them, I could not reference them both and
use them or else I'd have a conflict because .NET would not know which
dll's methods I am referring to (now I understand that you can get
around that with aliases and such but that's not relevant to my
overall question).

If in VS 2005, namespaces are not a part of webservice component, then
if I have a web application that references two web services with a
class name of Customer, aren't I going to run into the same problem?
If not, why not? It seems strange to me that namespaces would just
not be there at all but could be added, because that seems to leave
open the strong possibility that someone is going to do something
wrong.

Am I way off base here or not understanding what you are getting at?

Apr 10 '07 #7
"Doogie" <dn******@dtgne t.comwrote in message
news:11******** **************@ e65g2000hsc.goo glegroups.com.. .
Hi John, I am still confused. I understand the difference between
client/server namespaces. But take out the fact that we're talking
about a web service altogether here and let's just deal with the fact
that it is a .NET dll.

If I have a windows application in .NET and I reference two dlls and
they both happened to have a class name of Customer, without the
unique namespace attached to them, I could not reference them both and
use them or else I'd have a conflict because .NET would not know which
dll's methods I am referring to (now I understand that you can get
around that with aliases and such but that's not relevant to my
overall question).

If in VS 2005, namespaces are not a part of webservice component, then
if I have a web application that references two web services with a
class name of Customer, aren't I going to run into the same problem?
If not, why not? It seems strange to me that namespaces would just
not be there at all but could be added, because that seems to leave
open the strong possibility that someone is going to do something
wrong.

Am I way off base here or not understanding what you are getting at?
You're not alone in being off-base in this way. In fact, Microsoft seems to
encourage it.

A large proportion of the confusion I hear about from web service newbies
stems from the fact that Microsoft has tried too hard to make Web Services
just magically work. This is good in one sense. On the other hand, it means
that people can get quite far in before understanding the ways in which web
services are different from other development models.

So, if you don't need to look "under the covers", it's perfectly fine to go
ahead and think of Web Services as just another kind of RPC; in fact, to
think of it just like a local procedure call. But occasionally, the
difference will show itself and bite you when you don't know to be looking!
In those situations, please keep the following in mind, even though it
contradicts the "magic" model:

******* The client and the server are totally unrelated *******
One implication of this is that the namespace of some class on the server it
totally irrelevant to any discussion about the client.

In fact, I think the best way to think about web services is to pretend you
don't know what platform the client and server are running on. Just assume
that you've got some Perl script or something running on a web server, and
that you've got, say, a VBScript file running on the client. The VBScript
client sends some "<XML/>" to the server and the server parses it with
regular expressions or something, then sends some "<XML/>" back.

Notice: there are no namespaces in the above example. There are no classes.
There are no methods. There was (implicitly) a WSDL somewhere, but it's all
XML itself!

It's all just XML traveling over the wire. This is not only the underlying
implementation, it is also the source of the limitations. No namespaces, no
classes, no constructors, no nothing except XML.
Now, as to your original question, Visual Studio.NET is clever enough to not
allow you to name two Web References the same thing, and to use the name of
the Web Reference in the namespace of the generated proxy classes. This will
cause them to be in different namespaces. So, even if you have two
references to the exact same service, you'll be ok because the Web
References have different names, hence different namespaces.

I hope that helps more than the lecture hurts! ;-)

John Saunders [MVP]
Apr 10 '07 #8
Now, as to your original question, Visual Studio.NET is clever enough to not
allow you to name two Web References the same thing, and to use the name of
the Web Reference in the namespace of the generated proxy classes. This will
cause them to be in different namespaces. So, even if you have two
references to the exact same service, you'll be ok because the Web
References have different names, hence different namespaces.

I hope that helps more than the lecture hurts! ;-)

Yes it did. That last statement made a lot of sense (and I probably
should have known that!) Thanks!

Apr 10 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
3033
by: Steven Bethard | last post by:
In the "empty classes as c structs?" thread, we've been talking in some detail about my proposed "generic objects" PEP. Based on a number of suggestions, I'm thinking more and more that instead of a single collections type, I should be proposing a new "namespaces" module instead. Some of my reasons: (1) Namespace is feeling less and less like a collection to me. Even though it's still intended as a data-only structure, the use cases...
5
2364
by: M Shafaat | last post by:
Hi, I want to develop a number of generic components which I intend to use in different applications. Is it a good idea to put all these generic components in one and the same namespace, e.g. named GenApplCtrls, without any regard to whether or not the components have any functionality in common? Which principles should be considered when deciding which classes to belong to a namespace?
4
396
by: mabster | last post by:
Hi folks, I'm just starting to come to grips with web services in general, and I'm in the process of making some test projects based on example code from MSDN etc. When I create a new ASP.NET web service, VS.NET makes a new .cs file for me that includes the web service class itself, inside a new namespace. In an example today (to manage a table of Levies) I renamed the Web
1
1972
by: Jeremy Chapman | last post by:
I am trying to use xpath queries on an xmldocument passed to my web service. The document nodes have namespace prefixes. How can I programatically create an xpath query and run it assuming that the namespace and prefix could potentially change? Here is an example of my xml (from an infopath form in this case, but could be from any application) <?xml version="1.0" encoding="UTF-8"?> <?mso-infoPathSolution solutionVersion="1.0.0.52"...
0
885
by: Igor | last post by:
Please help us with a small problem! We are working with Microsoft Visual Studio .NET 2005 Beta 2. The project contains four laiers. The user interface module written in VB.NET, the Web Services also in VB.NET, another module wtitten on C# and the last module in C++.NET. We defined Some interfaces in every modules: In C++ module: GenName.Server.Logic.Wrapper In C# GenName.Server.Logic
2
1012
by: Amil | last post by:
I was reading "Rick Strahl's WebLog" and he mentions that in .net 2.0 web apps, there are no namespaces (I verified this by creating simple web app). I converted a VS 2003 web app that had namespaces and the VS 2005 still has them in there. Should I remove them? I'm also having an issue dynamically loading user controls and think it might have to do with the use of namespaces. Amil
16
3514
by: TT (Tom Tempelaere) | last post by:
Hi all, I created an XSD to define the structure of an XML file for my project. I made an XML file linked to the XSD using XmlSpy. The problem is that if I read the file using .NET XmlDocument and then query for the root element, the result is always null (1). However if I strip the root element of all attributes generated by XmlSpy, then there is no problem to find the root element with .NET XML classes (2). (1) The XML for which...
5
1595
by: Simon | last post by:
I have problem with namespaces. I have a program that consumes the web service and has for instance names space nsProgram. In this program I have defined several classes that I use for storing and handling internal information. Than I have web service, that also uses the same classes (I included the file as linked external resource). I included this web service as web reference and used name wsWeb. When I am trying to call the web...
6
1717
by: =?Utf-8?B?TUNN?= | last post by:
What is the difference between importing a namespace at the: 1. Project level 2. web.config level 3. Page level What are the requirements/benefits of each? If I import a namespace such as System.Collections at the Project level and the user calls a page that does not use that namespace, is that wasting
0
8142
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8642
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8591
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8294
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5549
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2575
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1438
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.