473,378 Members | 1,391 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,378 software developers and data experts.

Custom types

Which is the best and convenient way to send/retrun custom types to/from Web
Service? Serialization?

The web service is not to be public accessible, it's a part of n-tier
application.

TIA

Nov 19 '05 #1
20 1182
Nikolay,

In my opinion it is just using it, most serialization is done for you by
VSNet. When not as with an arraylist you have to decide what you do, however
it will always be serialized by VSNet to XML.

Just my thought,

Cor

"Nikolay Petrov"
Which is the best and convenient way to send/retrun custom types to/from
Web Service? Serialization?

The web service is not to be public accessible, it's a part of n-tier
application.

TIA

Nov 19 '05 #2
Cor Ligthert wrote:
Nikolay,

In my opinion it is just using it, most serialization is done for you
by VSNet. When not as with an arraylist you have to decide what you
do, however it will always be serialized by VSNet to XML.

Just my thought,

Cor

I have tried returning some custom type from a webservice. Some data
did get through, but in a *generated* class that only has *some* resemblance
to the original type. Do you know if there is some way to have the calling
side use the same type (apart from creating that "by hand" and copying
all values)?

Hans Kesting

"Nikolay Petrov"
Which is the best and convenient way to send/retrun custom types
to/from Web Service? Serialization?

The web service is not to be public accessible, it's a part of n-tier
application.

TIA

Nov 19 '05 #3
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something like
them.

Is it appropriate to use hash tables?
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl...
Cor Ligthert wrote:
Nikolay,

In my opinion it is just using it, most serialization is done for you
by VSNet. When not as with an arraylist you have to decide what you
do, however it will always be serialized by VSNet to XML.

Just my thought,

Cor


I have tried returning some custom type from a webservice. Some data
did get through, but in a *generated* class that only has *some*
resemblance
to the original type. Do you know if there is some way to have the calling
side use the same type (apart from creating that "by hand" and copying
all values)?

Hans Kesting

"Nikolay Petrov"
Which is the best and convenient way to send/retrun custom types
to/from Web Service? Serialization?

The web service is not to be public accessible, it's a part of n-tier
application.

TIA


Nov 19 '05 #4
Nikolay Petrov wrote:
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something
like them.

Is it appropriate to use hash tables?


Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the method in
the asmx as returning an int. When you call this you will get an integer back.
For these basic types serialization issues are handled automatically by the
system, you don't need to do anything special.

Hans Kesting
Nov 19 '05 #5
Hans,

Did you made those classes <serializable>?

Cor
Nov 19 '05 #6
Nikolay,

When you need a table, than in my opinion is the most easy one to use the
dataset.
Everything is than done for you.

I hope this helps,

Cor

"Nikolay Petrov"
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something like
them.

Is it appropriate to use hash tables?
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:Oj**************@TK2MSFTNGP12.phx.gbl...
Cor Ligthert wrote:
Nikolay,

In my opinion it is just using it, most serialization is done for you
by VSNet. When not as with an arraylist you have to decide what you
do, however it will always be serialized by VSNet to XML.

Just my thought,

Cor


I have tried returning some custom type from a webservice. Some data
did get through, but in a *generated* class that only has *some*
resemblance
to the original type. Do you know if there is some way to have the
calling
side use the same type (apart from creating that "by hand" and copying
all values)?

Hans Kesting

"Nikolay Petrov"

Which is the best and convenient way to send/retrun custom types
to/from Web Service? Serialization?

The web service is not to be public accessible, it's a part of n-tier
application.

TIA



Nov 19 '05 #7
No I need to return both in one call.

As you would declare structure

Structure Type
Dim Digit as Integer
Dim Text as String
End Structure

I want to return something similar, no need to be structure just I need to
return strings, integers, booleans as a whole.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nikolay Petrov wrote:
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something
like them.

Is it appropriate to use hash tables?


Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the method
in
the asmx as returning an int. When you call this you will get an integer
back.
For these basic types serialization issues are handled automatically by
the
system, you don't need to do anything special.

Hans Kesting

Nov 19 '05 #8
Nikolay Petrov wrote:
No I need to return both in one call.

As you would declare structure

Structure Type
Dim Digit as Integer
Dim Text as String
End Structure

I want to return something similar, no need to be structure just I
need to return strings, integers, booleans as a whole.


So you want to return a single value, but you can't declare as (for ex.) "string"
because it also can be int, bool, ...
Would it work to just declare it as "object"? The receiving side should
then check the type ("is bool", "is int", .. (in C# syntax) ) to handle it further.

Hans Kesting

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nikolay Petrov wrote:
What I need mostly is to return data with different types as
strings, integers an so, currently I don't need to return classes
or something like them.

Is it appropriate to use hash tables?


Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the
method in
the asmx as returning an int. When you call this you will get an
integer back.
For these basic types serialization issues are handled automatically
by the
system, you don't need to do anything special.

Hans Kesting

Nov 19 '05 #9
Nikolay,

As advice do not use a structure for this just a serializable class.

<Serializable()> Public Class Myfields
Public fielda As Integer
Public fieldb As String
End Class

In this message is a sample I made some months ago

http://groups-beta.google.com/group/...4488e73599d6fa

I hope this helps?

Cor

"Nikolay Petrov" <jo**************@mail.bg>
..
No I need to return both in one call.

As you would declare structure

Structure Type
Dim Digit as Integer
Dim Text as String
End Structure

I want to return something similar, no need to be structure just I need to
return strings, integers, booleans as a whole.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nikolay Petrov wrote:
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something
like them.

Is it appropriate to use hash tables?


Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the
method in
the asmx as returning an int. When you call this you will get an integer
back.
For these basic types serialization issues are handled automatically by
the
system, you don't need to do anything special.

Hans Kesting


Nov 19 '05 #10
This sounds more convenient
But maybe DataSet is more easy to use in my scenario
Any advantages/disadvantages of using Dataset instead or serialized data, in
my case?


"Cor Ligthert" <no************@planet.nl> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
Nikolay,

As advice do not use a structure for this just a serializable class.

<Serializable()> Public Class Myfields
Public fielda As Integer
Public fieldb As String
End Class

In this message is a sample I made some months ago

http://groups-beta.google.com/group/...4488e73599d6fa

I hope this helps?

Cor

"Nikolay Petrov" <jo**************@mail.bg>
.
No I need to return both in one call.

As you would declare structure

Structure Type
Dim Digit as Integer
Dim Text as String
End Structure

I want to return something similar, no need to be structure just I need
to return strings, integers, booleans as a whole.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nikolay Petrov wrote:
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something
like them.

Is it appropriate to use hash tables?

Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the
method in
the asmx as returning an int. When you call this you will get an integer
back.
For these basic types serialization issues are handled automatically by
the
system, you don't need to do anything special.

Hans Kesting



Nov 19 '05 #11
Why use a class? Structures are serializable, and don't have the overhead
associated with classes. We have numerous WebMethods that return structures,
and even arrays of structures.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:Or**************@TK2MSFTNGP10.phx.gbl...
Nikolay,

As advice do not use a structure for this just a serializable class.

<Serializable()> Public Class Myfields
Public fielda As Integer
Public fieldb As String
End Class

In this message is a sample I made some months ago

http://groups-beta.google.com/group/...4488e73599d6fa
I hope this helps?

Cor

"Nikolay Petrov" <jo**************@mail.bg>
.
No I need to return both in one call.

As you would declare structure

Structure Type
Dim Digit as Integer
Dim Text as String
End Structure

I want to return something similar, no need to be structure just I need to return strings, integers, booleans as a whole.
"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Nikolay Petrov wrote:
What I need mostly is to return data with different types as strings,
integers an so, currently I don't need to return classes or something
like them.

Is it appropriate to use hash tables?

Do you mean you want to have a webservice method that returns an int
(and another that returns a string)? That is easy, just declare the
method in
the asmx as returning an int. When you call this you will get an integer back.
For these basic types serialization issues are handled automatically by
the
system, you don't need to do anything special.

Hans Kesting



Nov 19 '05 #12
Kevin,
Why use a class? Structures are serializable, and don't have the overhead
associated with classes. We have numerous WebMethods that return
structures,
and even arrays of structures.

This contribution sounds for me like from a kid from 4.

Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.

Cor


Nov 19 '05 #13
Apparently, you are not concerned with performance. I guess only us
4-year-olds care about such childish concerns.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#4**************@TK2MSFTNGP10.phx.gbl...
Kevin,
Why use a class? Structures are serializable, and don't have the overhead associated with classes. We have numerous WebMethods that return
structures,
and even arrays of structures.

This contribution sounds for me like from a kid from 4.

Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.

Cor

Nov 19 '05 #14
>> >Why use a class? Structures are serializable, and don't have the
>overhead
associated with classes. We have numerous WebMethods that return
structures, and even arrays of structures.
This contribution sounds for me like from a kid from 4.
Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.
Apparently, you are not concerned with performance. I guess only us
4-year-olds care about such childish concerns.

This sounds again as from kids from 4-years-olds, who say that cars with a
structure of a Ford are much faster than those from a class as Ferrari.
There are more kids whose daddy has a Ford, than whose has a Ferrari;
however, that says nothing about the performance.

Grown up tell why a Ford is faster than a Ferrari when they want to discuss
that, they don't type something like this above or words as "the overhead
involved", without telling what overhead.

Cor
Nov 19 '05 #15
Nikolay,

I would not know why, in my opinion holds a serialized dataset almost the
same node information as any other type when it is XML serialized. (When we
are talking about collections of course, otherwise I think that the answers
from Hans and me are the same)

Cor
Nov 19 '05 #16
"Cor Ligthert" <no************@planet.nl> schrieb:
>Why use a class? Structures are serializable, and don't have the
>overhead
>>associated with classes. We have numerous WebMethods that return
>>structures, and even arrays of structures.This contribution sounds for me like from a kid from 4.
Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.

Apparently, you are not concerned with performance. I guess only us
4-year-olds care about such childish concerns.


This sounds again as from kids from 4-years-olds, who say that cars with a
structure of a Ford are much faster than those from a class as Ferrari.
There are more kids whose daddy has a Ford, than whose has a Ferrari;
however, that says nothing about the performance.


Comparing things with cars is never a good idea(TM).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 19 '05 #17
Herfried,

Not your TM, however kids do.

:-)))

Cor
"Herfried K. Wagner [MVP]" <hi***************@gmx.at>
"Cor Ligthert" <no************@planet.nl> schrieb:
>Why use a class? Structures are serializable, and don't have the
>overhead
>>associated with classes. We have numerous WebMethods that return
>>structures, and even arrays of structures.

This contribution sounds for me like from a kid from 4.
Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.

Apparently, you are not concerned with performance. I guess only us
4-year-olds care about such childish concerns.


This sounds again as from kids from 4-years-olds, who say that cars with
a structure of a Ford are much faster than those from a class as Ferrari.
There are more kids whose daddy has a Ford, than whose has a Ferrari;
however, that says nothing about the performance.


Comparing things with cars is never a good idea(TM).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 19 '05 #18
> Grown up tell why a Ford is faster than a Ferrari when they want to
discuss

Grown ups don't behave like you do, kid. When you're grown up, you'll
understand. Until then, you might try to act like one.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#5**************@TK2MSFTNGP14.phx.gbl...
>Why use a class? Structures are serializable, and don't have the
>overhead
>associated with classes. We have numerous WebMethods that return
>structures, and even arrays of structures.This contribution sounds for me like from a kid from 4.
Daddy why must I drink limonade and not whiskey?
My friend is allowed to drink whiskey and he says that is better.
Apparently, you are not concerned with performance. I guess only us
4-year-olds care about such childish concerns.

This sounds again as from kids from 4-years-olds, who say that cars with a
structure of a Ford are much faster than those from a class as Ferrari.
There are more kids whose daddy has a Ford, than whose has a Ferrari;
however, that says nothing about the performance.

Grown up tell why a Ford is faster than a Ferrari when they want to

discuss that, they don't type something like this above or words as "the overhead
involved", without telling what overhead.

Cor

Nov 19 '05 #19
Kevin,
Grown ups don't behave like you do, kid. When you're grown up, you'll
understand. Until then, you might try to act like one.


As I wrote in the dotnet.general newsgroup too somebody else where is a long
spamming thread, when somebody looses a discussion they starts to give the
winner names.

Cor
Nov 19 '05 #20
You mean like "4-year old?"

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:#V**************@TK2MSFTNGP10.phx.gbl...
Kevin,
Grown ups don't behave like you do, kid. When you're grown up, you'll
understand. Until then, you might try to act like one.
As I wrote in the dotnet.general newsgroup too somebody else where is a

long spamming thread, when somebody looses a discussion they starts to give the
winner names.

Cor

Nov 19 '05 #21

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

Similar topics

4
by: CrispinH | last post by:
I'm building an application generator and within it a user can create a new property (for the class they are building). I'd like then to offer a list of Types - built-in and custom - for this new...
5
by: mtv | last post by:
Hi all, I have the following code: ================================ Webservice side: public class MyWS: WebService { private myLib.DataObject curDataObject;
6
by: kbs | last post by:
Hi, I'm looking for some good examples that illustrate how to code a web service that exposes a custom collection so that the properties of the collection are accessible on the client without...
1
by: Kris | last post by:
I read a column on sharing types between web services at http://msdn.microsoft.com/library/en-us/dnservice/html/service07162002.asp Sharing types can be acheived, similar to what described here...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
7
by: John Grandy | last post by:
My ASP.NET Web Service project has a Web Method that returns an array filled with instances of a custom class. The custom class is defined in a Class Library that is included in the web-service...
2
by: gbanister | last post by:
I'd like to repost a message that I found in this group almost one year ago, because it's the exact problem I'm in and there was no solution offered to this post last year. (note: I was not the...
11
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I have worked with application settings in VS2005 and C# for awhile, but usually with standard types. I have been trying to store a custom container/class/type in an application setting and I have...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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.