Re: How to return a user-defined data type object from a webservice?
- From: "John Saunders [MVP]" <john.saunders at trizetto.com>
- Date: Sat, 1 Mar 2008 20:07:42 -0500
"nano2k" <adrian.rotaru@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
.
- Follow-Ups:
- Prev by Date: Re: WCF and fileStream
- Next by Date: Re: How to return a user-defined data type object from a webservice?
- Previous by thread: Re: Issue using an unmanaged dll in a ASP.Net 2.0 Webservice
- Next by thread: Re: How to return a user-defined data type object from a webservice?
- Index(es):
Relevant Pages
|
Loading