473,785 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.DB 2Connection 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 8806
"RJ" <RJ@PostOnly.co m> wrote in message
news:ut******** ******@TK2MSFTN GP15.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.DB 2Connection 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.E xecuteReader.
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******** ********@TK2MSF TNGP10.phx.gbl. ..
"RJ" <RJ@PostOnly.co m> wrote in message
news:ut******** ******@TK2MSFTN GP15.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.DB 2Connection 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
510
by: dgaucher | last post by:
Hi, I want to consume a Web Service that returns a choice, but my C++ client always receives the same returned type. On the other hand, when I am using a Java client, it is working fine (of course, the generated proxy is not the same). When I am looking at the C++ generated code, it seems fine, but when I am executing the code, I always get the first choice type.
0
2343
by: psy000 | last post by:
Hi, I have a C# web service client that talks to a JAVA application sever. I use AXIS to generate the WSDL file, use wsdl.exe to generate proxy stub c# code. When I try to use c# client connect to application server, I did not get the result in the C# client side, I used a soap monitor to look at the SOAP messages that were exchanged, I can see server returned a correct SOAP message, but the C# client failed to deserialize the XML...
0
2503
by: umhlali | last post by:
I get the following exception when my VB.NET app calls a Java web service that returns an array of objects. The same call works for a single object though. So looks like there is no problem serializing the object but there seems to be a problem serializing an array of objects. Any help will be appreciated "Cannot assign object of type System.Object to an object of type ElectronicWallet.C2PTest.PaymentItem." :...
8
7192
by: Marc | last post by:
Hi! I'm calling a web service using C# and a wrapper class generated by wsdl tool. The web service specification contains some nillable parameters which types are Value Types in .NET (long, int, Decimal, ....) and I must to send them as null, and not their default value. It is possible? Is there any trick to succeed it? Thanks in advance,
0
2315
by: Peter Conrey | last post by:
I have a perl web service (using SOAP::Lite) with a method called "Detail" that returns a strucure (hash reference to be exact). It works fine when consumed by a Perl client, but when I try to consume it with a C# application, I get the following runtime error from C#: Cannot assign object of type System.Xml.XmlNode to an object of type ConsoleApplication1.com.hilton.crmdev.SummaryType. Below is the Perl code that generates the hash,...
3
5075
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the data. my client code creates an XML document class, fills the data using standard xml dom...
1
4170
by: Vaibhav Modak | last post by:
Hi All, I have a Web Service written in Java (Web Logic) and I am trying to call it in my ASP. NET client. I am facing a problem while getting the data from the Web Service Method. My Web Service returns me an object which is a wrapper around an array of objects. (Earlier I was trying to read the array directly but could not succeed - so I wrapped that array with another object.) Now the primary issue is regarding the chunky characters...
3
5006
by: Olivier BESSON | last post by:
Hello, I have a web service of my own on a server (vb.net). I must declare it with SoapRpcMethod to be used with JAVA. This is a simple exemple method of my vb source : >************************************************************************ > <WebMethod(), System.Web.Services.Protocols.SoapRpcMethod()> _ > Public Function HelloWorld() As > <System.Xml.Serialization.SoapElementAttribute("return")> String
3
6097
by: Jeremy Chapman | last post by:
I've writtin a very simple web service in axis which returns an array of classes. I consume it in a .net app. When receiving the response, my .net app generates an error "Cannot assign object of type System.Object to an object of type PersonWS.WorkGroupData.". I've included the wsdl of the consumed axis web service, the request/responses of the web service by the .net app and the exception and stack trace. Hoping someone can tell me...
0
1802
by: vpal61 | last post by:
Hello, I have an Excel/VBA web service client with SOAP Toolkit, consuming Apache Tomcat webservice, which is working fine. Now I am trying to migrate to .NET, and build client in VS2005 with VSTO in C#. The problem is that all array types as returned by client are empty (simple types are OK). Any help very appreciated. Thanks, Vadim
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10325
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7499
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.