[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webservices

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

Ben

7/7/2003 11:50:00 PM

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" <gtharman@prologis.com> wrote in message
news:eqgLLXIRDHA.2224@TK2MSFTNGP12.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" <kaustubh@maximizelearning.com> wrote in message
> news:eo$%232DIRDHA.2176@TK2MSFTNGP12.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.
>
>


3 Answers

Giri Tharmananthar

7/8/2003 10:15:00 AM

0

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" <mustbejoking@120spamsaday.con> wrote in message
news:eAbbVKORDHA.1712@TK2MSFTNGP12.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" <gtharman@prologis.com> wrote in message
> news:eqgLLXIRDHA.2224@TK2MSFTNGP12.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" <kaustubh@maximizelearning.com> wrote in message
> > news:eo$%232DIRDHA.2176@TK2MSFTNGP12.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

7/9/2003 9:26:00 PM

0

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" <gtharman@prologis.com> wrote in message
news:O9xUXnTRDHA.2088@TK2MSFTNGP11.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" <mustbejoking@120spamsaday.con> wrote in message
> news:eAbbVKORDHA.1712@TK2MSFTNGP12.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" <gtharman@prologis.com> wrote in message
> > news:eqgLLXIRDHA.2224@TK2MSFTNGP12.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" <kaustubh@maximizelearning.com> wrote in message
> > > news:eo$%232DIRDHA.2176@TK2MSFTNGP12.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.
> > >
> > >
> >
> >
>
>


yhhuang

7/10/2003 3:10:00 AM

0

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? http://www.got...
--------------------
!From: "Giri" <gtharman@prologis.com>
!References: <u#p2ckHRDHA.704@tk2msftngp13.phx.gbl>
<eo$#2DIRDHA.2176@TK2MSFTNGP12.phx.gbl>
<eqgLLXIRDHA.2224@TK2MSFTNGP12.phx.gbl>
<eAbbVKORDHA.1712@TK2MSFTNGP12.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.2088@TK2MSFTNGP11.phx.gbl>
!Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
!NNTP-Posting-Host: 193.67.177.98
!Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
!Xref: cpmsftngxa09.phx.gbl
microsoft.public.dotnet.framework.aspnet.webservices:2582
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices
!
!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" <mustbejoking@120spamsaday.con> wrote in message
!news:eAbbVKORDHA.1712@TK2MSFTNGP12.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" <gtharman@prologis.com> wrote in message
!> news:eqgLLXIRDHA.2224@TK2MSFTNGP12.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" <kaustubh@maximizelearning.com> wrote in message
!> > news:eo$%232DIRDHA.2176@TK2MSFTNGP12.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.
!> >
!> >
!>
!>
!
!
!