473,386 Members | 2,078 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.

Web service references - Namespace problem

I have created a website using .NET Framework 2.0 with some web services that
share the same object model (defined in the App_Code).
When adding web references to these web services from a web application,
they assume the same namespace and I have no problem passing objects between
them.
Example:
MyNamespace.Webservice_A ws_A = new MyNamespace.Webservice_A();
MyNamespace.WebService_B ws_B = new MyNamespace.WebService_B();
MyNamespace.Class1 class1 = ws_A.GetClass1();
ws_B.Consume(class1);

The problem appeard when I created a windows application and tried to do the
same. Now, I cannot associate both web services with the same namespace.
Example in the windows application:

MyNamespace_A.Webservice_A ws_A = new MyNamespace_A.Webservice_A();
MyNamespace_B.WebService_B ws_B = new MyNamespace_B.WebService_B();
MyNamespace_A.Class1 class1 = ws_A.GetClass1();
ws_B.Consume(class1);

I get an error saying I cannot convert from MyNamespace_A.Class1 to
MyNamespace_B.Class1

Can anyone help me?
Thanks
Nov 24 '05 #1
2 6713
Hello MarioPereira,

Try to remove XML decraration of class that declared in method of ws_B.Consume()
from the WebService_B proxy class (that was automatically generated)

M> I have created a website using .NET Framework 2.0 with some web
M> services that
M> share the same object model (defined in the App_Code).
M> When adding web references to these web services from a web
M> application,
M> they assume the same namespace and I have no problem passing objects
M> between
M> them.
M> Example:
M> MyNamespace.Webservice_A ws_A = new MyNamespace.Webservice_A();
M> MyNamespace.WebService_B ws_B = new MyNamespace.WebService_B();
M> MyNamespace.Class1 class1 = ws_A.GetClass1();
M> ws_B.Consume(class1);
M> The problem appeard when I created a windows application and tried to
M> do the same. Now, I cannot associate both web services with the same
M> namespace. Example in the windows application:
M>
M> MyNamespace_A.Webservice_A ws_A = new MyNamespace_A.Webservice_A();
M> MyNamespace_B.WebService_B ws_B = new MyNamespace_B.WebService_B();
M> MyNamespace_A.Class1 class1 = ws_A.GetClass1(); ws_B.Consume(class1);
M>
M> I get an error saying I cannot convert from MyNamespace_A.Class1 to
M> MyNamespace_B.Class1
M>
M> Can anyone help me?
M> Thanks
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Nov 27 '05 #2
Michael Nemtsev, thanks for replying.

Is WebService_B.wsdl the proxy class?
I tried to remove the class declaration in the XML but it didn't work.
The only thing that worked was to change the namespace in the Reference.cs
of the WebService_B folder and then remove the repeated declarations. It was
like merging WebService_A/Reference.cs with WebService_B/Reference.cs.
The problem is that everytime I update the web references, the code is
re-generated and I have my problem again.
Is there any other way around?

"Michael Nemtsev" wrote:
Hello MarioPereira,

Try to remove XML decraration of class that declared in method of ws_B.Consume()
from the WebService_B proxy class (that was automatically generated)

M> I have created a website using .NET Framework 2.0 with some web
M> services that
M> share the same object model (defined in the App_Code).
M> When adding web references to these web services from a web
M> application,
M> they assume the same namespace and I have no problem passing objects
M> between
M> them.
M> Example:
M> MyNamespace.Webservice_A ws_A = new MyNamespace.Webservice_A();
M> MyNamespace.WebService_B ws_B = new MyNamespace.WebService_B();
M> MyNamespace.Class1 class1 = ws_A.GetClass1();
M> ws_B.Consume(class1);
M> The problem appeard when I created a windows application and tried to
M> do the same. Now, I cannot associate both web services with the same
M> namespace. Example in the windows application:
M>
M> MyNamespace_A.Webservice_A ws_A = new MyNamespace_A.Webservice_A();
M> MyNamespace_B.WebService_B ws_B = new MyNamespace_B.WebService_B();
M> MyNamespace_A.Class1 class1 = ws_A.GetClass1(); ws_B.Consume(class1);
M>
M> I get an error saying I cannot convert from MyNamespace_A.Class1 to
M> MyNamespace_B.Class1
M>
M> Can anyone help me?
M> Thanks
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/members/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche

Nov 28 '05 #3

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

Similar topics

2
by: PatrickSA | last post by:
Hi, Am new to web services, so apologies for the basic nature of the question - and apologies in advance if this is the wrong newsgroup. We're building a new web service and I'm looking around...
0
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem...
5
by: Derek Martin | last post by:
I am creating a windows service and have added a reference to a DLL project that I have created. That DLL file is correctly referenced in both a windows app and a web app, all in the same...
2
by: Richard Collette | last post by:
Hi, I have a service, that runs perfectly when executed outside of the web service environment. When called as a web service I get the exception listed below sporadically. A call to the web...
6
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public...
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...
0
by: =?Utf-8?B?QW5keSBZdQ==?= | last post by:
Hi, I'm trying to return exceptions from a WCF Service using FaultExceptions. I got the service compiled and running. But I get an error while adding a service reference to it. The error reads: "...
3
by: =?Utf-8?B?Q3JhaWc=?= | last post by:
Background: I am building a Windows enterprise application that has separate assemblies for UI, business logic/rules, and data access (i.e. typical N-tier architecture). Many of the assemblies...
20
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
I was executing the steps given in http://suppor.microsoft.com/kb/308359 for testing a sample web service application. However, the following line gives a compilation error: localhost.Service1...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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.