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



Thanks, John.


On 2 Mar, 03:07, "John Saunders [MVP]" <john.saunders at trizetto.com>
wrote:
"nano2k" <adrian.rot...@xxxxxxxxxxx> wrote in message

news:e44dea5c-53db-4e3a-b73f-fc0148296ca7@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hi

In my solution I have 3 projects:

1. A class library. Let's name it CL (let's also name the namespace as
"CL").
...
Where do I go wrong? How to "transport" more complex objects between
client and the webserver.
I understand how serialization works and I think the serialization
should implicitly work when returning such complex types. Maybe I
missed something.
Should I explicitly use soap serialization and deserialization? Hope
not.

You went wrong in not understanding web services. Web Services don't
"transport" complex types. They transport XML. In order to keep you from
having to deal with XML, .NET allows the service to "return" a complex type,
CL.Person. .NET then takes care of serializing that complex type into XML.
On the client side, in order to keep the client from having to deal with
XML, .NET creates proxy classes. In particular, it creates a
WebReferenceName.Person class. That is whtat the proxy GetPerson method
returns, not CL.Person.

So, long story short, your client should never reference the class library
"CL".
--
---------------------------------------------------------------------------­-----
John Saunders | MVP - Windows Server System - Connected System Developer

.



Relevant Pages

  • Re: DataSet and serialization is dangerous
    ... I myself don't think XML serialization really has a problem. ... are only two choices when a diffgram is in this state, ... >> perl client, etc. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: How to return a user-defined data type object from a webservice?
    ... client and the webserver. ... I understand how serialization works and I think the serialization ... should implicitly work when returning such complex types. ... They transport XML. ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: How to return a user-defined data type object from a webservice?
    ... client and the webserver. ... I understand how serialization works and I think the serialization ... should implicitly work when returning such complex types. ... They transport XML. ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: WebService returns a custom object
    ... There are many many attributes that control serialization. ... WebService returns a custom object ... WS can expose only the following types as ... > service infrastructure or any commercial tools will provide a client side ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: delegate question
    ... information of the method that the delegate is attached to. ... the server, and never get to you (a copy of your client will be sent to the ... event is remoted back to the client, ... the> client-runtime throws serialization exceptions of classes that are not> relevant for my client. ...
    (microsoft.public.dotnet.framework.remoting)

Loading