![]() |
Click here to advertise with us
|
|
|||||||
| Web Services Anything about web service development with VB.NET |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have a simple webservice with a function that returns a simple string array of ten items. When I call the function from my application it will not let me copy the returned array to another variable. I can count the array and access individual items however whenever I try to copy as shown below..
dim i as string() i = webservice.getstringarray() the program complains saying 'arrayofstring cannot be converted to 1-dimensional array of string' the code is below im totally lost!!!!!! <WebMethod()> _ Public Function Get_Practices() As String() Dim PCB_Practices(1) As String PCB_Practices(0) = "one" PCB_Practices(1) = "two" Return PCB_Practices End Function Public Sub Get_Practices() Dim i As String() i = dummy_web_service_pointer.Get_Practices() <<Error line! End Sub |
|
||||
|
The string array is not one of the supported schema types so the return type of this method is defined by the service. Hover the GetPractices method and intellisense will tell you what type it is returning, or use Object Browser and have a look at the service proxy class. I'm using VB2008, not sure if that changed from VB2005, but here I have a ServiceReference namespace to the service proxy class that defines the return type as class ArrayOfString, a class that inherits List(Of String). So both these examples mean the same, but you should learn the first, it will help you use other services that similarly defines various return types.
Code:
Dim ar As ServiceReference1.ArrayOfString = serv.Get_Practices Dim l As List(Of String) = serv.Get_Practices
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|