471,071 Members | 1,299 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,071 software developers and data experts.

Web service serialization of return type

RJ
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 )?

Nov 23 '05 #1
2 8692
"RJ" <RJ@PostOnly.com> wrote in message
news:ut**************@TK2MSFTNGP15.phx.gbl...
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?
--
Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com
Nov 23 '05 #2
RJ
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

"Mickey Williams [C# MVP]" <my first name at servergeek dot com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
"RJ" <RJ@PostOnly.com> wrote in message
news:ut**************@TK2MSFTNGP15.phx.gbl...
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?
--
Mickey Williams
Author, "Visual C# .NET Core Ref", MS Press
www.neudesic.com
www.servergeek.com

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Peter Conrey | last post: by
3 posts views Thread by Jerome Cohen | last post: by
3 posts views Thread by Jeremy Chapman | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.