473,386 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Namespaces and web references

Greetings!

I am trying to understand strange behavior in a little test application I
put together to talk to a Web service. If I create an application and add a
Web reference to my web service, Intellisense knows about my web service and
my application builds and runs correctly. The code using the Web service
is:

namespace WebServiceTest
{
<snip>
private void button1_Click(object sender, System.EventArgs e)
{
localhost.CommandRelayer theRelayer;
}
}

But if I change the namespace to PrimeProData.Labels.WebServiceTest, the
name "localhost" is no longer recognized. I do not have a default namespace
set for this project. What do I have to do to make sure I can see a web
reference if I change the namespace of a project?

Thanks very much!

Rob
Nov 16 '05 #1
1 5430
Hi Rob,

When you first generated the Web Reference, the proxy that was created
contained code that was in the same namespace as your project. So, your
original web reference proxy is in the WebServiceTest.localhost namespace.
This is why it was easy for you to reference the Web Service with only
localhost.CommandRelayer.

When you changed your namespace to PrimeProData.Labels.WebServiceTest, then
the Web Service proxy was no longer in the same namespace as your code and
localhost.CommandRelayer doesn't work. Additionally, doing an update on the
Web Reference didn't work because your project properties probably still had
the default namespace of WebServiceTest.

One way to fix this is to right click on the project and select Properties.
In the Project Property Pages dialog, select Common Properties, General.
Then change the Default Namespace property to
PrimeProData.Labels.WebServiceTest. Select OK to close the dialog. Next,
open the Web References folder, right-click on localhost, and select Update
Web Reference. After this, your code should compile and run fine.

Joe
--
http://www.csharp-station.com

"Rob Richardson" <no*******@n2net.net> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
Greetings!

I am trying to understand strange behavior in a little test application I
put together to talk to a Web service. If I create an application and add a Web reference to my web service, Intellisense knows about my web service and my application builds and runs correctly. The code using the Web service
is:

namespace WebServiceTest
{
<snip>
private void button1_Click(object sender, System.EventArgs e)
{
localhost.CommandRelayer theRelayer;
}
}

But if I change the namespace to PrimeProData.Labels.WebServiceTest, the
name "localhost" is no longer recognized. I do not have a default namespace set for this project. What do I have to do to make sure I can see a web
reference if I change the namespace of a project?

Thanks very much!

Rob

Nov 16 '05 #2

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

Similar topics

0
by: Olav | last post by:
Hi, ive just started on a relatively large project - 100+ projects and assemblies. I find I spend a lot of time adding namespaces and references, etc to my projects. Typically there is a class I...
3
by: Jim Heavey | last post by:
Trying to get the hang of Namespaces. I have primarly developed in VB and am transitioning to C# and the .Net Environment. I have worked a bit with Java as well in school about a year or so ago....
9
by: Patty O'Dors | last post by:
Hi Can somebody please tell me what namespaces are actually for? I notice that when I start a new project in C#, it puts everything in a namespace of the same name as the project. I found them...
4
by: clintonG | last post by:
When using Visual Studio.NET I observe adding a new Web Form may have default References added such as... References o- System o- System.Data o- System.Drawing o- System.Web o- System.XML
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
6
by: douglass_davis | last post by:
Is the whole System namespace automatically imported?
8
by: Doogie | last post by:
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...
5
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.