Results 1 to 3 of 3

Thread: [RESOLVED] ArrayList - Passed over a web service

Threaded View

  1. #1

    Thread Starter
    Addicted Member darth vador's Avatar
    Join Date
    Jul 2005
    Posts
    148

    [RESOLVED] ArrayList - Passed over a web service

    I'm writing a simple little web service.

    Here are two functions from it:
    VB Code:
    1. <WebMethod()> _
    2.     Public Function addTwoNums(ByVal numOne As Integer, ByVal numTwo As Integer) As Long
    3.         addTwoNums = numOne + numTwo
    4.         Return addTwoNums
    5.     End Function
    6.  
    7.     <WebMethod()> _
    8.     Public Function yadda() As ArrayList
    9.         yadda = New ArrayList
    10.         Dim str As String
    11.         str = "one"
    12.         yadda.Add(str)
    13.         str = "two"
    14.         yadda.Add(str)
    15.         Return yadda
    16.     End Function

    On the other end I can use the addTwoNums() function fine.
    But when I want to get the ArrayList from the service, I get an errors.
    Here is the basic error.
    Error 1 Value of type '1-dimensional array of Object' cannot be converted to 'System.Collections.ArrayList'.
    Here is my code to suck down the arrayList()
    VB Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Dim result As ArrayList
    3.         result = thisServ.yadda()
    4.     End Sub

    I guess the arrayList is converted to a system.object when it is being consumed?? Can I not cast it back into an arrayList so I can run through the items returned??

    I've tried CType over and over to no avail.

    I'm wanting to get a list of data from the web service with one function call rather than have to create a function for each element of the service.
    Last edited by darth vador; Mar 9th, 2006 at 11:37 PM.

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