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.
> > >
> > >
> >
> >
>
>