473,782 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Web service_A ws_A = new MyNamespace.Web service_A();
MyNamespace.Web Service_B ws_B = new MyNamespace.Web Service_B();
MyNamespace.Cla ss1 class1 = ws_A.GetClass1( );
ws_B.Consume(cl ass1);

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.W ebservice_A ws_A = new MyNamespace_A.W ebservice_A();
MyNamespace_B.W ebService_B ws_B = new MyNamespace_B.W ebService_B();
MyNamespace_A.C lass1 class1 = ws_A.GetClass1( );
ws_B.Consume(cl ass1);

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

Can anyone help me?
Thanks
Nov 24 '05 #1
2 6737
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.Web service_A ws_A = new MyNamespace.Web service_A();
M> MyNamespace.Web Service_B ws_B = new MyNamespace.Web Service_B();
M> MyNamespace.Cla ss1 class1 = ws_A.GetClass1( );
M> ws_B.Consume(cl ass1);
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.W ebservice_A ws_A = new MyNamespace_A.W ebservice_A();
M> MyNamespace_B.W ebService_B ws_B = new MyNamespace_B.W ebService_B();
M> MyNamespace_A.C lass1 class1 = ws_A.GetClass1( ); ws_B.Consume(cl ass1);
M>
M> I get an error saying I cannot convert from MyNamespace_A.C lass1 to
M> MyNamespace_B.C lass1
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.ws dl 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.Web service_A ws_A = new MyNamespace.Web service_A();
M> MyNamespace.Web Service_B ws_B = new MyNamespace.Web Service_B();
M> MyNamespace.Cla ss1 class1 = ws_A.GetClass1( );
M> ws_B.Consume(cl ass1);
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.W ebservice_A ws_A = new MyNamespace_A.W ebservice_A();
M> MyNamespace_B.W ebService_B ws_B = new MyNamespace_B.W ebService_B();
M> MyNamespace_A.C lass1 class1 = ws_A.GetClass1( ); ws_B.Consume(cl ass1);
M>
M> I get an error saying I cannot convert from MyNamespace_A.C lass1 to
M> MyNamespace_B.C lass1
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
528
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 for documentation on a number of issues, including versioning of web service interfaces... I've spent the last few hours looking through books, Google, MSDN and surprisingly I have found little or nothing that explains/shows how to practically...
0
2503
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 serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
5
1665
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 solution, so I thought I could do the same for a service project. However, after successfully adding the reference and making sure the namespaces were correct, I cannot see any of my public methods and functions from the DLL file. Is there anything...
2
4957
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 method may succeed one time and not another. I cannot find any reason why it would work one time and not another. The exception occurs every two or three calls to the web method. The service utilizes a COM component provided by PeopleSoft...
6
3990
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 string UID; public string PWD; }
8
2830
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 WebService156 { ... }
0
2365
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: " Attempting to download metadata from 'http://localhost:4619/WCFService1/Service.svc' using WS-Metadata Exchange or DISCO. Error: Cannot import wsdl:portType Detail: An exception was thrown while running a WSDL import extension:
3
3140
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 reference a "name and address web service," which gives me validation lists for name honorifics (e.g. Dr, Mr, Miss, Mrs), name suffixes (e.g. Sr, Jr, III), and City/State/ZIP combos. The same name and address web service also can save and retrieve...
20
6753
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 xxx = new localhost.Service1(); localhost is not recognized by the compiler.
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10146
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
10080
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,...
1
7492
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6733
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
5378
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...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
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.