473,385 Members | 1,742 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,385 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 1332
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 =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...

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.