Re: How to return a user-defined data type object from a webservice?



"Bradley Plett" <plettb@xxxxxxxxxxxxxxxx> wrote in message
news:p28us3pka1v47mj23pg8njg36ldsgok4va@xxxxxxxxxx
What John is saying is all true, but it's a bit of an ivory tower
approach. Sometimes we developers have to bend the rules because it's
the easiest way to get the job done!

Anyway, I'm guessing that you have shared code between your server and
your client (probably using the same class code, shared in VSS). If
that's the case, what you're up against is simply the fact that the
object coming from the server via the web service is in a different
namespace from the object you want to use in your client. There are a
variety of ways of getting around this problem. For example, you can
use reflection and generics to change the namespace of the object in
question. Here's a code sample that will simply copy everything from
one object to another, assuming all their public properties are
identical:

Sorry, Bradley, you're wrong. It's not that the classes are in different
namespaces. They're different classes that happen to have a lot of names in
common. Try returning a custom type that has a non-default constructor, or
methods, or indexers. None of them will show up in the proxy classes because
none of them are described by XML Schema or WSDL.

Remember: they're _proxy_ classes. They are stand-ins for the real classes,
which never leave the server to travel over the wire. They only exist in
order to stand as proxy for the real classes, handling serialization and
deserialization.
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer


.



Relevant Pages

  • Re: About FP, folder permissions, and sysops...
    ... Perhaps my "Shame, shame, etc.. ... Your contention was that ASP is some evil scheme to entice developers to use ... 4.> Even if you allowed an unmonitored FTP upload to your server ... Bob Lehmann ...
    (microsoft.public.frontpage.addins)
  • Re: Best configuration for a web developer
    ... I don't agree with you where you say the server extensions method was "clunky", but it does seem 999 out of 1000 developers didn't understand it, don't know how to set it up properly, and probably never will. ... Up to and including VS.NET 2003 the web developer model made a lot of sense and you could switch online/offline between remote and local IIS and all using HTTP. ...
    (microsoft.public.vsnet.general)
  • Re: concurrency, threads and objects
    ... Yes, for example in high performance server design, where the server should be able to handle between thousand and ten thousand transactions per second. ... Threads are very cheap in linux 2.6, when they changed the kernel thread model, they did a test where they created one hundred thousand threads. ... Its almost exclusively coming from java developers, but also from developers of other languages, although not as much. ...
    (comp.lang.java.programmer)
  • Re: how to change the applications trust level?
    ... stored one server. ... In all other nodes showing security related errors. ... The proper way to handle development with multiple developers is NOT to ... Set up some form of source control. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: CGI PHP vs. FastCGI vs. mod_php vs. application server?
    ... I'd rather know up-front what's available to raise performance ... system, fine-tune your database server, etc. ... FastCGI | mod_php) vs. Java as an application server. ... developers recommend FastCGI. ...
    (comp.lang.php)

Loading