|
-
Nov 11th, 2004, 03:43 PM
#1
Thread Starter
Frenzied Member
How to deal with custom types in webservice
I have a webservice which returns a complextype
<Serializable()> _
Public Class Player
Public Name As String
Public Age As Integer
End Class
If I then want to write a client program which uses this webservice, and I don't ahve the "Player" dll file installed. How will I be able to tell which kind of object the webservice returns? This information is not available in the wsdl file. Can I typecast the returned object to something and then de-serialize it?
All I get is an object... the client doesn't know what a "Player" type is... but it need the data within that type. How do I handle it?? Basically, there two questions:
1) How can I find out what kind of complex data a webservice returns?
2) How can I recreate that complex type in my app?
This applies to using webservices not created by me... I have no definition of the complex type.
kind regards
Henrik
Last edited by MrNorth; Nov 11th, 2004 at 03:58 PM.
-
Nov 12th, 2004, 06:34 AM
#2
Retired VBF Adm1nistrator
There are only a set number of types that are serializable. Specifically; DataSets, XML, Intrinsic Data Types, Arrays etc.
I've had this problem myself and the way I deal with it is I create a serialize method that converts the data into a dataset or some xml, pass that through, and then piece it back together again on the other side.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Nov 12th, 2004, 11:15 AM
#3
Thread Starter
Frenzied Member
I kinda forgot that this Person class is defined in the proxy class, since it is described in the wsdl file. I did it like this at client side (without person.dll)
dim proxy as new localhost.PersonService
dim myPerson as new proxy.Person
myPerson = proxy.GetPerson(456734)
works like a charm... since the Person class is serializable
But sadly it doesn't work for arraylists and collection types... they are returned as simple arrays...
/Henrik
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|