Hi,
I have the following problem. I've created 2 WebServices (A and B) that
reference to the same assembly - Credentials. Each WebService (A and B)
expose method GetCredentials that returns the Credentials class.
public class ServiceA : System.Web.Services.WebService
{
[WebMethod]
public Credentials GetCredentials()
{
return (new Credentials());
}
}
The same code i in ServiceB.
Now I create a client and add the 2 Web references to WebServiceA and
WebServiceB. Here is the problem.
The following piece of code in my client is not compiled:
ServiceA a = new ServiceA();
ServiceB b = new ServiceB();
Credentials ca = a.GetCredentials();
Credentials cb = b.GetCredentials();
The compiler is confused which class I'm referencing and require an explicit
type conversion between 2 instances of Credentials. But they are the same
class! Any ideas?
Thanks in advance 9 2107
Hello Ed,
Unfortunately you have to convert one credential object to the other.
I dont know the intension behind this code but, One thing you could do to
solve the problem is have a service that only does getCredentials so now
you have 3 services. A, B and the new GetCredentials service. That way you
can have a single type and not worry about conversion.
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com http://www.geniant.com Hi, I have the following problem. I've created 2 WebServices (A and B) that reference to the same assembly - Credentials. Each WebService (A and B) expose method GetCredentials that returns the Credentials class. public class ServiceA : System.Web.Services.WebService { [WebMethod] public Credentials GetCredentials() { return (new Credentials()); } } The same code i in ServiceB.
Now I create a client and add the 2 Web references to WebServiceA and WebServiceB. Here is the problem.
The following piece of code in my client is not compiled:
ServiceA a = new ServiceA(); ServiceB b = new ServiceB(); Credentials ca = a.GetCredentials(); Credentials cb = b.GetCredentials(); The compiler is confused which class I'm referencing and require an explicit type conversion between 2 instances of Credentials. But they are the same class! Any ideas?
Thanks in advance
Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome
this if I'll use WSDL rather than Visual Studio to add the references? There
is no way to tell the framework that all the services refer to the same
Class? It seems like I'm not doing something unique, so I was hoping there is
a solution, may be some attribute...
"Dilip Krishnan" wrote: Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion.
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
Hi, I have the following problem. I've created 2 WebServices (A and B) that reference to the same assembly - Credentials. Each WebService (A and B) expose method GetCredentials that returns the Credentials class. public class ServiceA : System.Web.Services.WebService { [WebMethod] public Credentials GetCredentials() { return (new Credentials()); } } The same code i in ServiceB.
Now I create a client and add the 2 Web references to WebServiceA and WebServiceB. Here is the problem.
The following piece of code in my client is not compiled:
ServiceA a = new ServiceA(); ServiceB b = new ServiceB(); Credentials ca = a.GetCredentials(); Credentials cb = b.GetCredentials(); The compiler is confused which class I'm referencing and require an explicit type conversion between 2 instances of Credentials. But they are the same class! Any ideas?
Thanks in advance
Take a look at the generated proxy, use(wsdl.exe instead of add web
refernce), now for the services you'll have two Credential type each
belong to ServiceA and another is to ServiceB, remove the credential
class definition in your ServiceB(or ServiceA).. and if you put this two
files under the same namespace, it will share the type
regards
erymuzuan
Ed Gonen wrote: Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute...
"Dilip Krishnan" wrote:
Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion.
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
Hi, I have the following problem. I've created 2 WebServices (A and B) that reference to the same assembly - Credentials. Each WebService (A and B) expose method GetCredentials that returns the Credentials class. public class ServiceA : System.Web.Services.WebService { [WebMethod] public Credentials GetCredentials() { return (new Credentials()); } } The same code i in ServiceB.
Now I create a client and add the 2 Web references to WebServiceA and WebServiceB. Here is the problem.
The following piece of code in my client is not compiled:
ServiceA a = new ServiceA(); ServiceB b = new ServiceB(); Credentials ca = a.GetCredentials(); Credentials cb = b.GetCredentials(); The compiler is confused which class I'm referencing and require an explicit type conversion between 2 instances of Credentials. But they are the same class! Any ideas?
Thanks in advance
Right, this is not something unique.
What Dilip suggests will work, but there is a better way. What you should
do is modify the generated types (generated by "Add Web Reference...") so
that they share a single type. This article discusses the issue in greater
detail. http://msdn.microsoft.com/library/en...ce07162002.asp
The same difficulty arises if you use wsdl.exe and build the proxies from
the command line. The same workaround applies.
In whidbey (.NET 2.0, which is in beta now), the situation is much better.
You can specify a single shared type and there is no need for manual
modification of the generated proxy (Stub) code.
Best,
-Dino
"Ed Gonen" <Ed*****@discussions.microsoft.com> wrote in message
news:51**********************************@microsof t.com... Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute...
"Dilip Krishnan" wrote:
Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion.
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
> Hi, > I have the following problem. I've created 2 WebServices (A and B) > that > reference to the same assembly - Credentials. Each WebService (A and > B) > expose method GetCredentials that returns the Credentials class. > public class ServiceA : System.Web.Services.WebService > { > [WebMethod] > public Credentials GetCredentials() > { > return (new Credentials()); > } > } > The same code i in ServiceB. > > Now I create a client and add the 2 Web references to WebServiceA and > WebServiceB. Here is the problem. > > The following piece of code in my client is not compiled: > > ServiceA a = new ServiceA(); > ServiceB b = new ServiceB(); > Credentials ca = a.GetCredentials(); > Credentials cb = b.GetCredentials(); > The compiler is confused which class I'm referencing and require an > explicit type conversion between 2 instances of Credentials. But they > are the same class! Any ideas? > > Thanks in advance >
Thanks,
That is exactly what I was doing when got your reply :). This works fine
but, of course, the problem is that I'll have to do that every time I update
the Web References, as the file is regenerated. I'm just so surprised Visual
Studio does not take care on this... Am I right?
Ed
"erymuzuan" wrote: Take a look at the generated proxy, use(wsdl.exe instead of add web refernce), now for the services you'll have two Credential type each belong to ServiceA and another is to ServiceB, remove the credential class definition in your ServiceB(or ServiceA).. and if you put this two files under the same namespace, it will share the type
regards erymuzuan
Ed Gonen wrote: Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute...
"Dilip Krishnan" wrote:
Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion.
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
Hi, I have the following problem. I've created 2 WebServices (A and B) that reference to the same assembly - Credentials. Each WebService (A and B) expose method GetCredentials that returns the Credentials class. public class ServiceA : System.Web.Services.WebService { [WebMethod] public Credentials GetCredentials() { return (new Credentials()); } } The same code i in ServiceB.
Now I create a client and add the 2 Web references to WebServiceA and WebServiceB. Here is the problem.
The following piece of code in my client is not compiled:
ServiceA a = new ServiceA(); ServiceB b = new ServiceB(); Credentials ca = a.GetCredentials(); Credentials cb = b.GetCredentials(); The compiler is confused which class I'm referencing and require an explicit type conversion between 2 instances of Credentials. But they are the same class! Any ideas?
Thanks in advance
Dino,
Thanks for the reply. It seems like in all cases I'll have to edit the the
proxy files after generation manually (or write a simple utility that does
that). Am I missing anything? That is what the article you mention says. Is
that correct? And are you saying there is a solution for that in 2.0?
"Dino Chiesa [Microsoft]" wrote: Right, this is not something unique.
What Dilip suggests will work, but there is a better way. What you should do is modify the generated types (generated by "Add Web Reference...") so that they share a single type. This article discusses the issue in greater detail. http://msdn.microsoft.com/library/en...ce07162002.asp
The same difficulty arises if you use wsdl.exe and build the proxies from the command line. The same workaround applies.
In whidbey (.NET 2.0, which is in beta now), the situation is much better. You can specify a single shared type and there is no need for manual modification of the generated proxy (Stub) code.
Best,
-Dino "Ed Gonen" <Ed*****@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com... Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute...
"Dilip Krishnan" wrote:
Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion.
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
> Hi, > I have the following problem. I've created 2 WebServices (A and B) > that > reference to the same assembly - Credentials. Each WebService (A and > B) > expose method GetCredentials that returns the Credentials class. > public class ServiceA : System.Web.Services.WebService > { > [WebMethod] > public Credentials GetCredentials() > { > return (new Credentials()); > } > } > The same code i in ServiceB. > > Now I create a client and add the 2 Web references to WebServiceA and > WebServiceB. Here is the problem. > > The following piece of code in my client is not compiled: > > ServiceA a = new ServiceA(); > ServiceB b = new ServiceB(); > Credentials ca = a.GetCredentials(); > Credentials cb = b.GetCredentials(); > The compiler is confused which class I'm referencing and require an > explicit type conversion between 2 instances of Credentials. But they > are the same class! Any ideas? > > Thanks in advance >
Hello erymuzuan, Take a look at the generated proxy, use(wsdl.exe instead of add web refernce), now for the services you'll have two Credential type each belong to ServiceA and another is to ServiceB, remove the credential class definition in your ServiceB(or ServiceA).. and if you put this two files under the same namespace, it will share the type
Wouldnt advise this as you will loose all your changes every time you regenerate
the proxy class
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com http://www.geniant.com
Hello Ed,
Yes in 2.0 you can share types.... :) [0]
[0] - http://www.theserverside.net/blogs/s...SStrikesBackP6
HTH
Regards,
Dilip Krishnan
MCAD, MCSD.net
dkrishnan at geniant dot com http://www.geniant.com Dino, Thanks for the reply. It seems like in all cases I'll have to edit the the proxy files after generation manually (or write a simple utility that does that). Am I missing anything? That is what the article you mention says. Is that correct? And are you saying there is a solution for that in 2.0? "Dino Chiesa [Microsoft]" wrote:
Right, this is not something unique.
What Dilip suggests will work, but there is a better way. What you should do is modify the generated types (generated by "Add Web Reference...") so that they share a single type. This article discusses the issue in greater detail. http://msdn.microsoft.com/library/en...service0716200 2.asp
The same difficulty arises if you use wsdl.exe and build the proxies from the command line. The same workaround applies.
In whidbey (.NET 2.0, which is in beta now), the situation is much better. You can specify a single shared type and there is no need for manual modification of the generated proxy (Stub) code.
Best,
-Dino
"Ed Gonen" <Ed*****@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com...
Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute... "Dilip Krishnan" wrote:
Hello Ed, Unfortunately you have to convert one credential object to the other. I dont know the intension behind this code but, One thing you could do to solve the problem is have a service that only does getCredentials so now you have 3 services. A, B and the new GetCredentials service. That way you can have a single type and not worry about conversion. HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com > Hi, > I have the following problem. I've created 2 WebServices (A and B) > that > reference to the same assembly - Credentials. Each WebService (A > and > B) > expose method GetCredentials that returns the Credentials class. > public class ServiceA : System.Web.Services.WebService > { > [WebMethod] > public Credentials GetCredentials() > { > return (new Credentials()); > } > } > The same code i in ServiceB. > Now I create a client and add the 2 Web references to WebServiceA > and WebServiceB. Here is the problem. > > The following piece of code in my client is not compiled: > > ServiceA a = new ServiceA(); > ServiceB b = new ServiceB(); > Credentials ca = a.GetCredentials(); > Credentials cb = b.GetCredentials(); > The compiler is confused which class I'm referencing and require > an > explicit type conversion between 2 instances of Credentials. But > they > are the same class! Any ideas? > Thanks in advance >
Thanks a lot, the whole thread was very helpful
"Dilip Krishnan" wrote: Hello Ed, Yes in 2.0 you can share types.... :) [0]
[0] - http://www.theserverside.net/blogs/s...SStrikesBackP6
HTH Regards, Dilip Krishnan MCAD, MCSD.net dkrishnan at geniant dot com http://www.geniant.com
Dino, Thanks for the reply. It seems like in all cases I'll have to edit the the proxy files after generation manually (or write a simple utility that does that). Am I missing anything? That is what the article you mention says. Is that correct? And are you saying there is a solution for that in 2.0? "Dino Chiesa [Microsoft]" wrote:
Right, this is not something unique.
What Dilip suggests will work, but there is a better way. What you should do is modify the generated types (generated by "Add Web Reference...") so that they share a single type. This article discusses the issue in greater detail. http://msdn.microsoft.com/library/en...service0716200 2.asp
The same difficulty arises if you use wsdl.exe and build the proxies from the command line. The same workaround applies.
In whidbey (.NET 2.0, which is in beta now), the situation is much better. You can specify a single shared type and there is no need for manual modification of the generated proxy (Stub) code.
Best,
-Dino
"Ed Gonen" <Ed*****@discussions.microsoft.com> wrote in message news:51**********************************@microsof t.com...
Dilip,
Thanks a lot for the reply. Do you think there might be a way to overcome this if I'll use WSDL rather than Visual Studio to add the references? There is no way to tell the framework that all the services refer to the same Class? It seems like I'm not doing something unique, so I was hoping there is a solution, may be some attribute... "Dilip Krishnan" wrote:
> Hello Ed, > Unfortunately you have to convert one credential object to the > other. > I dont know the intension behind this code but, One thing you could > do to > solve the problem is have a service that only does getCredentials > so now > you have 3 services. A, B and the new GetCredentials service. That > way > you > can have a single type and not worry about conversion. > HTH > Regards, > Dilip Krishnan > MCAD, MCSD.net > dkrishnan at geniant dot com > http://www.geniant.com >> Hi, >> I have the following problem. I've created 2 WebServices (A and B) >> that >> reference to the same assembly - Credentials. Each WebService (A >> and >> B) >> expose method GetCredentials that returns the Credentials class. >> public class ServiceA : System.Web.Services.WebService >> { >> [WebMethod] >> public Credentials GetCredentials() >> { >> return (new Credentials()); >> } >> } >> The same code i in ServiceB. >> Now I create a client and add the 2 Web references to WebServiceA >> and WebServiceB. Here is the problem. >> >> The following piece of code in my client is not compiled: >> >> ServiceA a = new ServiceA(); >> ServiceB b = new ServiceB(); >> Credentials ca = a.GetCredentials(); >> Credentials cb = b.GetCredentials(); >> The compiler is confused which class I'm referencing and require >> an >> explicit type conversion between 2 instances of Credentials. But >> they >> are the same class! Any ideas? >> Thanks in advance >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Speybrouck |
last post by:
I have a little problem with a webservice. I reproduced the problem in the
following simplified example.
I just create a new C# ASP.NET webservice and a c# console application.
I added a new...
|
by: Mantorok |
last post by:
Hi all
I have a web service and it is going fine until I call a method that returns
an object that is based on a class from a referenced .net assembly.
The problem is my calling code doesn't...
|
by: Andy |
last post by:
Make the story short, I have a VB.NET client interface calling .NET
webservice, written in VB.NET as well.
I am trying to make the client as thin as possible so I let the
webservice part to...
|
by: Miguel |
last post by:
Hi,
I'm developing an application in C# with Windows Forms for my company
that is similar to the MSN Messenger. This application uses a
webservice for registering users, etc... and as 2...
|
by: el_sid |
last post by:
Our developers have experienced a problem with updating Web References in
Visual Studio.NET 2003.
Normally, when a web service class (.asmx) is created, updating the Web
Reference will...
|
by: Jon Ebersole |
last post by:
I am developing a webservice and a windows application that talk to each
other. They are using a standard VB class library in the background. I am
having problems understanding why I can't sync my...
|
by: iKiLL |
last post by:
Hi all,
I am using C# on VS2005.
I have a solution with 2 projects, a Webservice and a Client application.
Both of these to projects can build compile and run.
|
by: Bradley Plett |
last post by:
I have run into this problem occasionally, and have crude ways of
getting around it, but I'm wondering if anyone else has a better, more
elegant solution.
I have a web service and a client...
|
by: Lance Wynn |
last post by:
Hello,
I am receiving this error when trying to instantiate a webservice component.
I have 2 development machines, both are XP sp2 with VS 2008 installed. On
one machine, the code works fine. On...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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...
| |