473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Exposing a class...

Hi guys, I have a class object I want to expose in a webservice
class... How can I make sure that all objects including subclasses are
exposed in WSDL. here is an example:

Public Class Lists '< - class for all lists..

Public Class List ' <- class for a single list contained in
Lists class...

' Member vars...
Public Records() As Record

' Sub classes...
Public Class Record ' <- Class for a single record which is
part of the list...

Public Fields() As Field

Public Class Field ' <- Class for a field. which is
part of the record...
Public Name As String
Public Value As Object
Public Type As String
End Class
End Class
End Class

End Class

Basically, what I want to do, is to be able to create an object like
this in the client...

Dim obj as new Lists.List.Record

or even

Dim obj as new Lists.List.Record.Field

My WebService class could expose it like this...

<WebMethod()> _
Public Function HelloWorld() As Lists '<- just exposing Lists could
trigger sub class exposition...
Return New Lists
End Function

Is that possible? Or do I have to create a function to expose each sub
class?

Tascien

Feb 8 '06 #1
4 1333
Anything serializable can be exposed in a Web Service. Some things are
easier to serialize than others. I suggest you read up on Serialization,
specifically XML Serialization.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"tascien" <ta******@ecoaches.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
Hi guys, I have a class object I want to expose in a webservice
class... How can I make sure that all objects including subclasses are
exposed in WSDL. here is an example:

Public Class Lists '< - class for all lists..

Public Class List ' <- class for a single list contained in
Lists class...

' Member vars...
Public Records() As Record

' Sub classes...
Public Class Record ' <- Class for a single record which is
part of the list...

Public Fields() As Field

Public Class Field ' <- Class for a field. which is
part of the record...
Public Name As String
Public Value As Object
Public Type As String
End Class
End Class
End Class

End Class

Basically, what I want to do, is to be able to create an object like
this in the client...

Dim obj as new Lists.List.Record

or even

Dim obj as new Lists.List.Record.Field

My WebService class could expose it like this...

<WebMethod()> _
Public Function HelloWorld() As Lists '<- just exposing Lists could
trigger sub class exposition...
Return New Lists
End Function

Is that possible? Or do I have to create a function to expose each sub
class?

Tascien

Feb 8 '06 #2
Ok,

thanks but, I thought it would be easy done without learning much about
Serialization...

what usually happens, I create my class in visual studio, inherit a
webservice class, and then when i browse to the webservice asmx, voila,
my class has been Serialized...

The only thing is that complex classes like the ones mentioned about
don't get Serialized correctly. so, I was wondering if there is any
keyword, or something that i need to do to achieve that...

In other words, I rely on visual studio to create my webservice and do
object serialization for me...

T.

Feb 9 '06 #3
You can mark things with the Serializable attribute. There is really
nothing that will ensure that all referenced objects are serializable until
runtime because serialization is not handled by the compiler.

I would learn at least the basics of serialization. One of the problems
with serialization is that if you want to de-serialize it on the other end,
you need to have a copy of the class available. Keep in mind that classes
cannot be miraculously created without a "template". So, if you want to
serialize complex classes that are not part of the framework, both ends need
that class.

"tascien" <ta******@ecoaches.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Ok,

thanks but, I thought it would be easy done without learning much about
Serialization...

what usually happens, I create my class in visual studio, inherit a
webservice class, and then when i browse to the webservice asmx, voila,
my class has been Serialized...

The only thing is that complex classes like the ones mentioned about
don't get Serialized correctly. so, I was wondering if there is any
keyword, or something that i need to do to achieve that...

In other words, I rely on visual studio to create my webservice and do
object serialization for me...

T.

Feb 9 '06 #4
As I mentioned, some things are more easy to serialize than others. The .Net
Framework can serialize some things with no help. For others, it requires
*your* help. That's why I told you to read up on XML Serialization.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"tascien" <ta******@ecoaches.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Ok,

thanks but, I thought it would be easy done without learning much about
Serialization...

what usually happens, I create my class in visual studio, inherit a
webservice class, and then when i browse to the webservice asmx, voila,
my class has been Serialized...

The only thing is that complex classes like the ones mentioned about
don't get Serialized correctly. so, I was wondering if there is any
keyword, or something that i need to do to achieve that...

In other words, I rely on visual studio to create my webservice and do
object serialization for me...

T.

Feb 9 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter Hemmingsen | last post by:
Hi, I have a dotnet object (implemented in mc++ and used in c#) which have a property called "Info". The Info property is also a dotnet object (implemented in mc++). In the constructor of the...
3
by: FredC | last post by:
How do you make a program's properties and methods availale so that other programs can "connect" to them at design time and then use them at run time?
1
by: David Dvali | last post by:
I have some basic questions please. What is the best way of exposing some protected properly of base class as public properly?
5
by: M O J O | last post by:
Hi, I want to expose a enum from another class, is that possible and how? Here's an example Public Class ClassMaster Public Enum Colors
8
by: Dave A | last post by:
I have a class called 'PrimaryKey' that represents the primary key of a table. PrimaryKeys can only be created and the class only implements .ToString(). The PrimaryKey class internally stores...
2
by: Rich | last post by:
Greetings, I observed that in VB2005 the designer generated code is hidden. The initialize code appears to be stored in a different module than the Form's class module. But the form's class...
1
by: Adam Clauss | last post by:
First, I have ComVisible set to true for the entire assembly. I have (abstract) base class A. There are interfaces IA and IAEvents for accessing properties of this object and exposing events. ...
4
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
We have a class that has a public property that is of type List<T>. FXCop generates a DoNotExposeGenericLists error, indicating "System.Collections.Generic.List<Tis a generic collection designed...
1
by: daokfella | last post by:
I have a custom server control that exposes a property which is a complex type. I expose the property as such: public class Automobile { public AutomobileEngine Engine { get { object o =...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.