2 Web Services and a Typed DataSet

Discussion in 'ASP .Net Web Services' started by pikachusalad, Aug 2, 2006.

  1. pikachusalad

    pikachusalad Guest

    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!
     
    pikachusalad, Aug 2, 2006
    #1
    1. Advertising

  2. "pikachusalad" <> wrote in message
    news:...
    >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
     
    John Saunders, Aug 2, 2006
    #2
    1. Advertising

  3. pikachusalad

    Matt Guest

    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/nl/community/columns/jdruyts/wsproxy.mspx

    John Saunders wrote:
    > "pikachusalad" <> wrote in message
    > news:...
    > >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
     
    Matt, Aug 3, 2006
    #3
  4. "Matt" <> wrote in message
    news:...
    > 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/nl/community/columns/jdruyts/wsproxy.mspx
    >
    > John Saunders wrote:
    >> "pikachusalad" <> wrote in message
    >> news:...
    >> >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

    >
     
    John Saunders, Aug 3, 2006
    #4
  5. pikachusalad

    Matt Guest

    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" <> wrote in message
    > news:...
    > > 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/nl/community/columns/jdruyts/wsproxy.mspx
    > >
    > > John Saunders wrote:
    > >> "pikachusalad" <> wrote in message
    > >> news:...
    > >> >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

    > >
     
    Matt, Aug 4, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nedu N
    Replies:
    1
    Views:
    1,818
    Chris Taylor
    Oct 31, 2003
  2. Nedu N
    Replies:
    2
    Views:
    2,173
  3. William Gower
    Replies:
    2
    Views:
    4,158
    Brian Baker [MVP]
    Jul 26, 2004
  4. thomson
    Replies:
    2
    Views:
    14,839
    Eliyahu Goldin
    Jan 19, 2005
  5. Nedu N
    Replies:
    2
    Views:
    228
    Jacob Yang [MSFT]
    Oct 31, 2003
Loading...

Share This Page