By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 971 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

Custom types

P: n/a
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 21 '05 #1
Share this Question
Share on Google+
20 Replies


P: n/a
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 21 '05 #2

P: n/a
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 21 '05 #3

P: n/a
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 21 '05 #4

P: n/a
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 21 '05 #5

P: n/a
Hans,

Did you made those classes <serializable>?

Cor
Nov 21 '05 #6

P: n/a
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 21 '05 #7

P: n/a
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 21 '05 #8

P: n/a
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 21 '05 #9

P: n/a
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 21 '05 #10

P: n/a
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 21 '05 #11

P: n/a
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 21 '05 #12

P: n/a
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 21 '05 #13

P: n/a
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 21 '05 #14

P: n/a
>> >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 21 '05 #15

P: n/a
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 21 '05 #16

P: n/a
"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 21 '05 #17

P: n/a
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 21 '05 #18

P: n/a
> 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 21 '05 #19

P: n/a
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 21 '05 #20

P: n/a
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 21 '05 #21

This discussion thread is closed

Replies have been disabled for this discussion.