Results 1 to 3 of 3

Thread: How to deal with custom types in webservice

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    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.

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    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]

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    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
  •  



Click Here to Expand Forum to Full Width