Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / March 2005

Tip: Looking for answers? Try searching our database.

Web service serialization of return type

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
RJ - 14 Mar 2005 18:54 GMT
I've been trying to find documentation that explains limitation of possible
types that a webmethod can return.  I realize xml serialization must take
place to return the specified type.

Must the return type of a webmethod implement ISerializable?  I saw
something about using SoapInclude or XMLInclude attribute to include other
types in web services.  Does this imply that it is possible to return any
type, even some third party class?   I'm really interested in returning
something like a IBM.Data.DB2.DB2Connection object from a web method.  I
tried this and I can compile the ws but whenever I try to reference it, I
get an exception ( Can't serialize Component.ISite )?
Mickey Williams [C# MVP] - 14 Mar 2005 20:34 GMT
> Must the return type of a webmethod implement ISerializable?

No.

>  I saw
> something about using SoapInclude or XMLInclude attribute to include other
> types in web services.

This is required when you have polymorphic behavior in serialized types.

> Does this imply that it is possible to return any
> type, even some third party class?

Any type that can be XML serialized. Remember that XML serialization is not
full-fidelity, and only public fields and properties will be serialized.

> I'm really interested in returning
> something like a IBM.Data.DB2.DB2Connection object from a web method.

That would be an incredibally bad idea if it were possible. Which it isn't.
Leaving aside the obvious secuirty and scalability problems, what would a
copy of the connection look like? How would a client program that received
the serialized connection use it remotely?

Signature

Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com

RJ - 14 Mar 2005 22:05 GMT
Mickey,
 Thanks for the info.  My real goal is to construct a connection pooling
gateway component that will reside on a server.  This component would accept
requests from many clients, and manage a limited number of DB2 connections
to a mainframe.  The DB2Connection object is a managed assembly from IBM,
which works like the .NET SQLClient.Data.Connection class.  A web service is
the first technology I looked at, not knowing if it will work or not, with
remoting the next option.

At the conceptual level, it doesn't seem so crazy.   If it is impossible to
implement, with no available mechanism to marshall a "usable" connection
object between computers- then yes it's not useful - that's what I'm trying
to understand.
The hope is that a client would receive the object, typecast it back to a
DB2Connection if needed, then be able to call DB2DataReader.ExecuteReader.
Yes, I'm hoping the reader would read from the mainframe, not the server.

If there is a way in .NET, via serialization or marshalling, that an object
of this nature, which obviously contains IP specific details, can be passed
between computers, I'm trying to understand what it is.  Thanks for
clarification.

RJ

> > Must the return type of a webmethod implement ISerializable?
>
[quoted text clipped - 19 lines]
> copy of the connection look like? How would a client program that received
> the serialized connection use it remotely?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.