S
Sam
Please I need help.
I am trying to call a web service method that returns an arraylist from my
windows application but I could not do it because of the following error
message:
(value of type '1-dimensional array of object' cannot be converted to
'system.collections.ArrayList')
I need just simply a piece of sample code that show me how to return an
arraylist from a web service method and how to consume it from the client
side the right way.
My web service Method is as follow:
<WebMethod(), XmlInclude(GetType(CustomerInfo))> _
Public Function CustomersList() As <XmlArray("CustList")> ArrayList
Dim _Result As New ArrayList
Dim oInfo1 As New CustomerInfo
oInfo1.CustomerNo = 1
oInfo1.CustomerName = "Customer1"
_Result.Add(oInfo1)
Dim oInfo2 As New CustomerInfo
oInfo2.CustomerNo = 2
oInfo2.CustomerName = "Customer2"
_Result.Add(oInfo2)
Return _Result
End Function
My windows application Call to the web service is as follow:
Private Sub CallWebservice()
Dim _Customer As New Customer.Customer
_Customer.Url = "http://localhost:1968/Customer.asmx"
Dim _Result As ArrayList
_Result = CType(_Customer.CustomersList, ArrayList)
End Sub
Thank you
I am trying to call a web service method that returns an arraylist from my
windows application but I could not do it because of the following error
message:
(value of type '1-dimensional array of object' cannot be converted to
'system.collections.ArrayList')
I need just simply a piece of sample code that show me how to return an
arraylist from a web service method and how to consume it from the client
side the right way.
My web service Method is as follow:
<WebMethod(), XmlInclude(GetType(CustomerInfo))> _
Public Function CustomersList() As <XmlArray("CustList")> ArrayList
Dim _Result As New ArrayList
Dim oInfo1 As New CustomerInfo
oInfo1.CustomerNo = 1
oInfo1.CustomerName = "Customer1"
_Result.Add(oInfo1)
Dim oInfo2 As New CustomerInfo
oInfo2.CustomerNo = 2
oInfo2.CustomerName = "Customer2"
_Result.Add(oInfo2)
Return _Result
End Function
My windows application Call to the web service is as follow:
Private Sub CallWebservice()
Dim _Customer As New Customer.Customer
_Customer.Url = "http://localhost:1968/Customer.asmx"
Dim _Result As ArrayList
_Result = CType(_Customer.CustomersList, ArrayList)
End Sub
Thank you