Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > 2 Web Services and a Typed DataSet

Reply
Thread Tools

2 Web Services and a Typed DataSet

 
 
pikachusalad
Guest
Posts: n/a
 
      08-02-2006
I am using Visual Studio 2005 Professional.

I have one web service (DataRequester) that would like to get a strongly
typed dataset from another web service (DataRetriever).

The strongly typed dataset (TheDataSet) comes from a class library
(TheLibrary), both web services have a reference to the TheLibrary.dll, and
can use the TheLibrary.TheDataSet just fine.

DataRetriever is able to fetch the data from the DB and put it into a nice
TheLibrary.TheDataSet, and then returns it from a WebMethod
(GetATheDataSet()), whose return type is TheLibrary.TheDataSet.

DataRequester has a Web Reference to DataRetriever, and has code like this:

WebReference.DataRetriever dataRetriever = new WebReference.DataRetriever();
TheLibrary.TheDataSet theDataSet = dataRetriever.GetATheDataSet();

I get the error, when trying to build:

Cannot implicitly convert type WebReference.TheDataSet to
TheLibrary.TheDataSet

Please, someone tell me there is a solution for this? The problem seems to
be that when I create the WebReference, I get a TheDataSet.xsd, and it
apparently doesn't understand that DataRetriever is returning a type that it
already knows about!

 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      08-02-2006
"pikachusalad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I am using Visual Studio 2005 Professional.
>
> I have one web service (DataRequester) that would like to get a strongly
> typed dataset from another web service (DataRetriever).
>
> The strongly typed dataset (TheDataSet) comes from a class library
> (TheLibrary), both web services have a reference to the TheLibrary.dll,
> and
> can use the TheLibrary.TheDataSet just fine.
>
> DataRetriever is able to fetch the data from the DB and put it into a nice
> TheLibrary.TheDataSet, and then returns it from a WebMethod
> (GetATheDataSet()), whose return type is TheLibrary.TheDataSet.
>
> DataRequester has a Web Reference to DataRetriever, and has code like
> this:
>
> WebReference.DataRetriever dataRetriever = new
> WebReference.DataRetriever();
> TheLibrary.TheDataSet theDataSet = dataRetriever.GetATheDataSet();
>
> I get the error, when trying to build:
>
> Cannot implicitly convert type WebReference.TheDataSet to
> TheLibrary.TheDataSet
>
> Please, someone tell me there is a solution for this? The problem seems
> to
> be that when I create the WebReference, I get a TheDataSet.xsd, and it
> apparently doesn't understand that DataRetriever is returning a type that
> it
> already knows about!



But it's not the same type!

Web services are loosely-coupled. The client only knows about the server
through the WSDL file, not through the client knowing about the types
exposed by the server by looking at a server assembly.

What's happening is that the client is using a type generated from the
schema in the WSDL file, and that schema is generated from the type on the
server; but the two types have nothing else to do with each other!

If you want the client to know the intimate details of the server, you
should use .NET Remoting instead of web services.

John


 
Reply With Quote
 
 
 
 
Matt
Guest
Posts: n/a
 
      08-03-2006
You can control how the proxy classes get generated with the
SchemaImporterExtension class (new in 2.0). The library or website
that consumes the web service needs a reference to TheLibrary. Using
the Schema Importer Extension (that you implement) you tell .NET not to
generate proxy classes but to use the classes from the library. This
article explains exactly how to do it and it isn't hard at all.

Customizing generated Web Service proxies in Visual Studio 2005
http://www.microsoft.com/belux/msdn/...s/wsproxy.mspx

John Saunders wrote:
> "pikachusalad" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >I am using Visual Studio 2005 Professional.
> >
> > I have one web service (DataRequester) that would like to get a strongly
> > typed dataset from another web service (DataRetriever).
> >
> > The strongly typed dataset (TheDataSet) comes from a class library
> > (TheLibrary), both web services have a reference to the TheLibrary.dll,
> > and
> > can use the TheLibrary.TheDataSet just fine.
> >
> > DataRetriever is able to fetch the data from the DB and put it into a nice
> > TheLibrary.TheDataSet, and then returns it from a WebMethod
> > (GetATheDataSet()), whose return type is TheLibrary.TheDataSet.
> >
> > DataRequester has a Web Reference to DataRetriever, and has code like
> > this:
> >
> > WebReference.DataRetriever dataRetriever = new
> > WebReference.DataRetriever();
> > TheLibrary.TheDataSet theDataSet = dataRetriever.GetATheDataSet();
> >
> > I get the error, when trying to build:
> >
> > Cannot implicitly convert type WebReference.TheDataSet to
> > TheLibrary.TheDataSet
> >
> > Please, someone tell me there is a solution for this? The problem seems
> > to
> > be that when I create the WebReference, I get a TheDataSet.xsd, and it
> > apparently doesn't understand that DataRetriever is returning a type that
> > it
> > already knows about!

>
>
> But it's not the same type!
>
> Web services are loosely-coupled. The client only knows about the server
> through the WSDL file, not through the client knowing about the types
> exposed by the server by looking at a server assembly.
>
> What's happening is that the client is using a type generated from the
> schema in the WSDL file, and that schema is generated from the type on the
> server; but the two types have nothing else to do with each other!
>
> If you want the client to know the intimate details of the server, you
> should use .NET Remoting instead of web services.
>
> John


 
Reply With Quote
 
John Saunders
Guest
Posts: n/a
 
      08-03-2006
"Matt" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> You can control how the proxy classes get generated with the
> SchemaImporterExtension class (new in 2.0). The library or website
> that consumes the web service needs a reference to TheLibrary. Using
> the Schema Importer Extension (that you implement) you tell .NET not to
> generate proxy classes but to use the classes from the library. This
> article explains exactly how to do it and it isn't hard at all.


The article is about .NET. If you're creating a web service to be consumed
only by .NET clients, then the article is fine. Otherwise, stay away from
SchemaImporterExtension!

BTW, if your web service is only for .NET clients, then you should consider
using .NET Remoting, which is much more powerful, and performs much better.

John

>
> Customizing generated Web Service proxies in Visual Studio 2005
> http://www.microsoft.com/belux/msdn/...s/wsproxy.mspx
>
> John Saunders wrote:
>> "pikachusalad" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> >I am using Visual Studio 2005 Professional.
>> >
>> > I have one web service (DataRequester) that would like to get a
>> > strongly
>> > typed dataset from another web service (DataRetriever).
>> >
>> > The strongly typed dataset (TheDataSet) comes from a class library
>> > (TheLibrary), both web services have a reference to the TheLibrary.dll,
>> > and
>> > can use the TheLibrary.TheDataSet just fine.
>> >
>> > DataRetriever is able to fetch the data from the DB and put it into a
>> > nice
>> > TheLibrary.TheDataSet, and then returns it from a WebMethod
>> > (GetATheDataSet()), whose return type is TheLibrary.TheDataSet.
>> >
>> > DataRequester has a Web Reference to DataRetriever, and has code like
>> > this:
>> >
>> > WebReference.DataRetriever dataRetriever = new
>> > WebReference.DataRetriever();
>> > TheLibrary.TheDataSet theDataSet = dataRetriever.GetATheDataSet();
>> >
>> > I get the error, when trying to build:
>> >
>> > Cannot implicitly convert type WebReference.TheDataSet to
>> > TheLibrary.TheDataSet
>> >
>> > Please, someone tell me there is a solution for this? The problem
>> > seems
>> > to
>> > be that when I create the WebReference, I get a TheDataSet.xsd, and it
>> > apparently doesn't understand that DataRetriever is returning a type
>> > that
>> > it
>> > already knows about!

>>
>>
>> But it's not the same type!
>>
>> Web services are loosely-coupled. The client only knows about the server
>> through the WSDL file, not through the client knowing about the types
>> exposed by the server by looking at a server assembly.
>>
>> What's happening is that the client is using a type generated from the
>> schema in the WSDL file, and that schema is generated from the type on
>> the
>> server; but the two types have nothing else to do with each other!
>>
>> If you want the client to know the intimate details of the server, you
>> should use .NET Remoting instead of web services.
>>
>> John

>



 
Reply With Quote
 
Matt
Guest
Posts: n/a
 
      08-04-2006
The Schema Importer Extension has no effect on clients that aren't
..NET. It is only invoked by the consumer, and only if it is directed
to do so by the .config section. My web service is consumed by a PHP
site as well as .NET. For the PHP site it behaves as it always has.
The Schema Importer Extension is harmless: you're just dictating that
the proxy classes are the same type as the objects on the server. It
has no effect on the web service itself and doesn't impact the
compatibility with non-.NET consumers.

John Saunders wrote:
> "Matt" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > You can control how the proxy classes get generated with the
> > SchemaImporterExtension class (new in 2.0). The library or website
> > that consumes the web service needs a reference to TheLibrary. Using
> > the Schema Importer Extension (that you implement) you tell .NET not to
> > generate proxy classes but to use the classes from the library. This
> > article explains exactly how to do it and it isn't hard at all.

>
> The article is about .NET. If you're creating a web service to be consumed
> only by .NET clients, then the article is fine. Otherwise, stay away from
> SchemaImporterExtension!
>
> BTW, if your web service is only for .NET clients, then you should consider
> using .NET Remoting, which is much more powerful, and performs much better.
>
> John
>
> >
> > Customizing generated Web Service proxies in Visual Studio 2005
> > http://www.microsoft.com/belux/msdn/...s/wsproxy.mspx
> >
> > John Saunders wrote:
> >> "pikachusalad" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> >I am using Visual Studio 2005 Professional.
> >> >
> >> > I have one web service (DataRequester) that would like to get a
> >> > strongly
> >> > typed dataset from another web service (DataRetriever).
> >> >
> >> > The strongly typed dataset (TheDataSet) comes from a class library
> >> > (TheLibrary), both web services have a reference to the TheLibrary.dll,
> >> > and
> >> > can use the TheLibrary.TheDataSet just fine.
> >> >
> >> > DataRetriever is able to fetch the data from the DB and put it into a
> >> > nice
> >> > TheLibrary.TheDataSet, and then returns it from a WebMethod
> >> > (GetATheDataSet()), whose return type is TheLibrary.TheDataSet.
> >> >
> >> > DataRequester has a Web Reference to DataRetriever, and has code like
> >> > this:
> >> >
> >> > WebReference.DataRetriever dataRetriever = new
> >> > WebReference.DataRetriever();
> >> > TheLibrary.TheDataSet theDataSet = dataRetriever.GetATheDataSet();
> >> >
> >> > I get the error, when trying to build:
> >> >
> >> > Cannot implicitly convert type WebReference.TheDataSet to
> >> > TheLibrary.TheDataSet
> >> >
> >> > Please, someone tell me there is a solution for this? The problem
> >> > seems
> >> > to
> >> > be that when I create the WebReference, I get a TheDataSet.xsd, and it
> >> > apparently doesn't understand that DataRetriever is returning a type
> >> > that
> >> > it
> >> > already knows about!
> >>
> >>
> >> But it's not the same type!
> >>
> >> Web services are loosely-coupled. The client only knows about the server
> >> through the WSDL file, not through the client knowing about the types
> >> exposed by the server by looking at a server assembly.
> >>
> >> What's happening is that the client is using a type generated from the
> >> schema in the WSDL file, and that schema is generated from the type on
> >> the
> >> server; but the two types have nothing else to do with each other!
> >>
> >> If you want the client to know the intimate details of the server, you
> >> should use .NET Remoting instead of web services.
> >>
> >> John

> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference Between Typed Dataset and Untyped Dataset thomson ASP .Net 2 01-19-2005 08:16 AM
Converting a generic Dataset to a typed dataset William Gower ASP .Net 2 07-26-2004 10:14 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 2 10-31-2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N ASP .Net 1 10-31-2003 02:39 AM



Advertisments