473,320 Members | 1,976 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,320 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 6710
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.