Professional Web Applications Themes

Typed DataSets, Web services and namespace confusion... - ASP.NET Web Services

Unless I am very much mistaken this is a feature. And this puzzled me for a while and I did the same as you, sensibly separating out the DataSet into its own assembly... reference this in the web service and also in the calling app. Good design. If the calling app can see the web service this is no problem, you reference the DataSet through the namespace of your web service but realistically this data could be heading for some backend service that cannot it, for very good security reasons. This is not unreasonable. What you need to do is ...

  1. #1

    Default Re: Typed DataSets, Web services and namespace confusion...

    Unless I am very much mistaken this is a feature. And this puzzled me for a
    while and I did the same as you, sensibly separating out the DataSet into
    its own assembly... reference this in the web service and also in the
    calling app. Good design. If the calling app can see the web service this
    is no problem, you reference the DataSet through the namespace of your web
    service but realistically this data could be heading for some backend
    service that cannot it, for very good security reasons. This is not
    unreasonable. What you need to do is a Merge from one to the other. You
    can set what happens when the Merge takes place and set the options so that
    it enforces type safety. The other chap is wrong about the namespace
    attribute of the web service as a solution, by the way. Don't try to cast,
    the compiler didn't seem to mind in VS 2002 but it was wrong and should have
    thrown an exception but a run time you start to get problems.

    E.g.

    namespace.webserivenamespace.classname srv = new
    namespace.webserivenamespace.classname();
    namespace.webserivenamespace.datasetname ds = srv.mymethod();
    namespace.datasetname ds2 = new namespace.datasetname();
    ds2.Merge(ds);

    See .Merge for the details about enforcing type safetly (the strictess
    option);

    Regards

    Ben







    "Giri" <gtharmanprologis.com> wrote in message
    news:eqgLLXIRDHA.2224TK2MSFTNGP12.phx.gbl...
    > Thanks for the suggestion but I am already doing this, the problem is not
    in
    > the namespace attached to the web service via the WebService attribute, it
    > is in the .net namespace that is being created when using typed
    datasets...
    >
    > Any other ideas ?
    >
    > "Kaustubh Vaze" <kaustubhmaximizelearning.com> wrote in message
    > news:eo$%232DIRDHA.2176TK2MSFTNGP12.phx.gbl...
    > > Try to tag your Web Service like this
    :[WebService(Namespace=http://+"any
    > > valid namespace")]
    > > public class MyWebService {
    > > // implementation
    > > }This will work.Regards,Kaustubh.
    >
    >

    Ben Guest

  2. #2

    Default Re: Typed DataSets, Web services and namespace confusion...

    Thanks for the input Ben, nice to know someone has struggled with the same
    issue. The problem I have with using merge for the solution is that it is
    clunky..

    I have managed to pinpoint the underlying problem to the following.

    If a web service exposes a return type as a typed dataset the automatic
    proxy generator feels obliged to create a copy of the typed data set and
    resulting code on the consumer end. This is not unreasonable IF the typed
    dataset doesn't already exist as an available type in the consumer.. what
    the proxy generator is not able to do is recognise that a type is already
    there (in the right namespace) and then NOT generate its own...

    This gets even worse IF two asmx pages are referenced by the consumer, both
    of which return the same Typed Dataset type... (you then end up with the
    same type in 3 places ! )

    phew..

    Long winded but hopefully someone in Microsoft is watching this enough to
    see the issue and add the necessary option to the proxy code generator to
    stop this from happening or a least giving us the option.

    The "kludge" I have found and am currently using ?

    Well you open the code generated by the proxy generator in visual studio
    (Web references / MyWebService/ Reference.cs) and REMOVE the generated Type
    for the Typed Dataset. This is not ideal as touching codegen code is always
    a bad idea... but hey, it works !

    Regards



    Giri


    "Ben" <mustbejoking120spamsaday.con> wrote in message
    news:eAbbVKORDHA.1712TK2MSFTNGP12.phx.gbl...
    > Unless I am very much mistaken this is a feature. And this puzzled me for
    a
    > while and I did the same as you, sensibly separating out the DataSet into
    > its own assembly... reference this in the web service and also in the
    > calling app. Good design. If the calling app can see the web service
    this
    > is no problem, you reference the DataSet through the namespace of your web
    > service but realistically this data could be heading for some backend
    > service that cannot it, for very good security reasons. This is not
    > unreasonable. What you need to do is a Merge from one to the other. You
    > can set what happens when the Merge takes place and set the options so
    that
    > it enforces type safety. The other chap is wrong about the namespace
    > attribute of the web service as a solution, by the way. Don't try to
    cast,
    > the compiler didn't seem to mind in VS 2002 but it was wrong and should
    have
    > thrown an exception but a run time you start to get problems.
    >
    > E.g.
    >
    > namespace.webserivenamespace.classname srv = new
    > namespace.webserivenamespace.classname();
    > namespace.webserivenamespace.datasetname ds = srv.mymethod();
    > namespace.datasetname ds2 = new namespace.datasetname();
    > ds2.Merge(ds);
    >
    > See .Merge for the details about enforcing type safetly (the strictess
    > option);
    >
    > Regards
    >
    > Ben
    >
    >
    >
    >
    >
    >
    >
    > "Giri" <gtharmanprologis.com> wrote in message
    > news:eqgLLXIRDHA.2224TK2MSFTNGP12.phx.gbl...
    > > Thanks for the suggestion but I am already doing this, the problem is
    not
    > in
    > > the namespace attached to the web service via the WebService attribute,
    it
    > > is in the .net namespace that is being created when using typed
    > datasets...
    > >
    > > Any other ideas ?
    > >
    > > "Kaustubh Vaze" <kaustubhmaximizelearning.com> wrote in message
    > > news:eo$%232DIRDHA.2176TK2MSFTNGP12.phx.gbl...
    > > > Try to tag your Web Service like this
    > :[WebService(Namespace=http://+"any
    > > > valid namespace")]
    > > > public class MyWebService {
    > > > // implementation
    > > > }This will work.Regards,Kaustubh.
    > >
    > >
    >
    >

    Giri Guest

  3. #3

    Default Re: Typed DataSets, Web services and namespace confusion...

    Yep I considered this but didn't want to change the autogenerated code for
    the proxy, however thinking about it the whole concept, a web service has a
    publicly available definition of it's interface through it's WSDL and it's
    return types. If I had a class called Utility in one name space and another
    called the same name in another namespace, http or .NET, I could not say
    they were the same. It would be making a mockery of namespaces. OK they
    might have the same interface but are they the same, no. OK they may even
    have the same binary implementation but their definition says they are
    different. That's why we have a special method Merge. Yep my gut initially
    was that Merge was clunky but conceptually I think you will agree it is
    right, that's why I said that lovely word 'feature'.

    Well I think there will have to be change to namespaces and the introduction
    of namespace mappings for this to move on properly. Namespaces are only
    different classification systems of specific items. Really a book is the
    same book which ever classification system it is under.

    Ben W




    "Giri" <gtharmanprologis.com> wrote in message
    news:O9xUXnTRDHA.2088TK2MSFTNGP11.phx.gbl...
    > Thanks for the input Ben, nice to know someone has struggled with the same
    > issue. The problem I have with using merge for the solution is that it is
    > clunky..
    >
    > I have managed to pinpoint the underlying problem to the following.
    >
    > If a web service exposes a return type as a typed dataset the automatic
    > proxy generator feels obliged to create a copy of the typed data set and
    > resulting code on the consumer end. This is not unreasonable IF the typed
    > dataset doesn't already exist as an available type in the consumer.. what
    > the proxy generator is not able to do is recognise that a type is already
    > there (in the right namespace) and then NOT generate its own...
    >
    > This gets even worse IF two asmx pages are referenced by the consumer,
    both
    > of which return the same Typed Dataset type... (you then end up with the
    > same type in 3 places ! )
    >
    > phew..
    >
    > Long winded but hopefully someone in Microsoft is watching this enough to
    > see the issue and add the necessary option to the proxy code generator to
    > stop this from happening or a least giving us the option.
    >
    > The "kludge" I have found and am currently using ?
    >
    > Well you open the code generated by the proxy generator in visual studio
    > (Web references / MyWebService/ Reference.cs) and REMOVE the generated
    Type
    > for the Typed Dataset. This is not ideal as touching codegen code is
    always
    > a bad idea... but hey, it works !
    >
    > Regards
    >
    >
    >
    > Giri
    >
    >
    > "Ben" <mustbejoking120spamsaday.con> wrote in message
    > news:eAbbVKORDHA.1712TK2MSFTNGP12.phx.gbl...
    > > Unless I am very much mistaken this is a feature. And this puzzled me
    for
    > a
    > > while and I did the same as you, sensibly separating out the DataSet
    into
    > > its own assembly... reference this in the web service and also in the
    > > calling app. Good design. If the calling app can see the web service
    > this
    > > is no problem, you reference the DataSet through the namespace of your
    web
    > > service but realistically this data could be heading for some backend
    > > service that cannot it, for very good security reasons. This is not
    > > unreasonable. What you need to do is a Merge from one to the other.
    You
    > > can set what happens when the Merge takes place and set the options so
    > that
    > > it enforces type safety. The other chap is wrong about the namespace
    > > attribute of the web service as a solution, by the way. Don't try to
    > cast,
    > > the compiler didn't seem to mind in VS 2002 but it was wrong and should
    > have
    > > thrown an exception but a run time you start to get problems.
    > >
    > > E.g.
    > >
    > > namespace.webserivenamespace.classname srv = new
    > > namespace.webserivenamespace.classname();
    > > namespace.webserivenamespace.datasetname ds = srv.mymethod();
    > > namespace.datasetname ds2 = new namespace.datasetname();
    > > ds2.Merge(ds);
    > >
    > > See .Merge for the details about enforcing type safetly (the strictess
    > > option);
    > >
    > > Regards
    > >
    > > Ben
    > >
    > >
    > >
    > >
    > >
    > >
    > >
    > > "Giri" <gtharmanprologis.com> wrote in message
    > > news:eqgLLXIRDHA.2224TK2MSFTNGP12.phx.gbl...
    > > > Thanks for the suggestion but I am already doing this, the problem is
    > not
    > > in
    > > > the namespace attached to the web service via the WebService
    attribute,
    > it
    > > > is in the .net namespace that is being created when using typed
    > > datasets...
    > > >
    > > > Any other ideas ?
    > > >
    > > > "Kaustubh Vaze" <kaustubhmaximizelearning.com> wrote in message
    > > > news:eo$%232DIRDHA.2176TK2MSFTNGP12.phx.gbl...
    > > > > Try to tag your Web Service like this
    > > :[WebService(Namespace=http://+"any
    > > > > valid namespace")]
    > > > > public class MyWebService {
    > > > > // implementation
    > > > > }This will work.Regards,Kaustubh.
    > > >
    > > >
    > >
    > >
    >
    >

    Ben Guest

  4. #4

    Default Re: Typed DataSets, Web services and namespace confusion...

    Hello All,

    We have looked into it and forwarded it to our product team as a customer
    suggestions. Thanks very much for your post. and it's this kind of feedback
    that let's us know what things you're trying to do, that we haven't yet
    exposed for you.

    Keep the information coming and thanks.

    Best regards,
    yhhuang
    VS.NET, Visual C++
    Microsoft

    This posting is provided "AS IS" with no warranties, and confers no rights.
    Got .Net? [url]http://www.gotdotnet.com[/url]
    --------------------
    !From: "Giri" <gtharmanprologis.com>
    !References: <u#p2ckHRDHA.704tk2msftngp13.phx.gbl>
    <eo$#2DIRDHA.2176TK2MSFTNGP12.phx.gbl>
    <eqgLLXIRDHA.2224TK2MSFTNGP12.phx.gbl>
    <eAbbVKORDHA.1712TK2MSFTNGP12.phx.gbl>
    !Subject: Re: Typed DataSets, Web services and namespace confusion...
    !Date: Tue, 8 Jul 2003 11:15:19 +0100
    !Lines: 105
    !X-Priority: 3
    !X-MSMail-Priority: Normal
    !X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    !X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    !Message-ID: <O9xUXnTRDHA.2088TK2MSFTNGP11.phx.gbl>
    !Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
    !NNTP-Posting-Host: 193.67.177.98
    !Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
    !Xref: cpmsftngxa09.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservic es:2582
    !X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
    !
    !Thanks for the input Ben, nice to know someone has struggled with the same
    !issue. The problem I have with using merge for the solution is that it is
    !clunky..
    !
    !I have managed to pinpoint the underlying problem to the following.
    !
    !If a web service exposes a return type as a typed dataset the automatic
    !proxy generator feels obliged to create a copy of the typed data set and
    !resulting code on the consumer end. This is not unreasonable IF the typed
    !dataset doesn't already exist as an available type in the consumer.. what
    !the proxy generator is not able to do is recognise that a type is already
    !there (in the right namespace) and then NOT generate its own...
    !
    !This gets even worse IF two asmx pages are referenced by the consumer, both
    !of which return the same Typed Dataset type... (you then end up with the
    !same type in 3 places ! )
    !
    !phew..
    !
    !Long winded but hopefully someone in Microsoft is watching this enough to
    !see the issue and add the necessary option to the proxy code generator to
    !stop this from happening or a least giving us the option.
    !
    !The "kludge" I have found and am currently using ?
    !
    !Well you open the code generated by the proxy generator in visual studio
    !(Web references / MyWebService/ Reference.cs) and REMOVE the generated Type
    !for the Typed Dataset. This is not ideal as touching codegen code is
    always
    !a bad idea... but hey, it works !
    !
    !Regards
    !
    !
    !
    !Giri
    !
    !
    !"Ben" <mustbejoking120spamsaday.con> wrote in message
    !news:eAbbVKORDHA.1712TK2MSFTNGP12.phx.gbl...
    !> Unless I am very much mistaken this is a feature. And this puzzled me
    for
    !a
    !> while and I did the same as you, sensibly separating out the DataSet into
    !> its own assembly... reference this in the web service and also in the
    !> calling app. Good design. If the calling app can see the web service
    !this
    !> is no problem, you reference the DataSet through the namespace of your
    web
    !> service but realistically this data could be heading for some backend
    !> service that cannot it, for very good security reasons. This is not
    !> unreasonable. What you need to do is a Merge from one to the other. You
    !> can set what happens when the Merge takes place and set the options so
    !that
    !> it enforces type safety. The other chap is wrong about the namespace
    !> attribute of the web service as a solution, by the way. Don't try to
    !cast,
    !> the compiler didn't seem to mind in VS 2002 but it was wrong and should
    !have
    !> thrown an exception but a run time you start to get problems.
    !>
    !> E.g.
    !>
    !> namespace.webserivenamespace.classname srv = new
    !> namespace.webserivenamespace.classname();
    !> namespace.webserivenamespace.datasetname ds = srv.mymethod();
    !> namespace.datasetname ds2 = new namespace.datasetname();
    !> ds2.Merge(ds);
    !>
    !> See .Merge for the details about enforcing type safetly (the strictess
    !> option);
    !>
    !> Regards
    !>
    !> Ben
    !>
    !>
    !>
    !>
    !>
    !>
    !>
    !> "Giri" <gtharmanprologis.com> wrote in message
    !> news:eqgLLXIRDHA.2224TK2MSFTNGP12.phx.gbl...
    !> > Thanks for the suggestion but I am already doing this, the problem is
    !not
    !> in
    !> > the namespace attached to the web service via the WebService attribute,
    !it
    !> > is in the .net namespace that is being created when using typed
    !> datasets...
    !> >
    !> > Any other ideas ?
    !> >
    !> > "Kaustubh Vaze" <kaustubhmaximizelearning.com> wrote in message
    !> > news:eo$%232DIRDHA.2176TK2MSFTNGP12.phx.gbl...
    !> > > Try to tag your Web Service like this
    !> :[WebService(Namespace=http://+"any
    !> > > valid namespace")]
    !> > > public class MyWebService {
    !> > > // implementation
    !> > > }This will work.Regards,Kaustubh.
    !> >
    !> >
    !>
    !>
    !
    !
    !

    Yan-Hong Huang[MSFT] Guest

Similar Threads

  1. Web Services and Strongly Typed Collections
    By Brian Orrell in forum ASP.NET Web Services
    Replies: 0
    Last Post: May 5th, 08:15 PM
  2. IPTables namespace - how to commandeer namespace
    By Derrik Pates in forum PERL Modules
    Replies: 1
    Last Post: January 20th, 08:52 AM
  3. DBNull problems - typed datasets - webservices
    By JezB in forum ASP.NET Web Services
    Replies: 3
    Last Post: January 12th, 04:34 PM
  4. Web-services, DataSets and Updates
    By Eirik M. in forum ASP.NET Web Services
    Replies: 0
    Last Post: September 2nd, 04:47 PM
  5. Webservices and strongly typed datasets
    By Thomas Zaleski in forum ASP.NET Web Services
    Replies: 0
    Last Post: July 9th, 03:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139