Visual Basic .NET Forums  
Click here to advertise with us

Go Back   Visual Basic .NET Forums > ASP.NET > Web Services

Web Services Anything about web service development with VB.NET

VB.NET Forums Newsletter Signup:
Email address:


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-07-2009, 7:55 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jan 2009
Age: 24
Posts: 6
Reputation: 0
karimallen is on a distinguished programming path ahead
Default Webservice Passing Arrays Problem

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-07-2009, 3:58 PM
JohnH's Avatar
VB.NET Forum Moderator
.NET Framework: .NET 3.5 (VS 2008)
 
Join Date: Dec 2005
Location: Norway
Age: 37
Posts: 10,325
Reputation: 1315
JohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond reputeJohnH has a reputation beyond repute
Default

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
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-08-2009, 7:50 AM
VB.NET Forum Newbie
.NET Framework: .NET 2.0 (VS 2005)
 
Join Date: Jan 2009
Age: 24
Posts: 6
Reputation: 0
karimallen is on a distinguished programming path ahead
Default

thanks thats exactly what i needed
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





All times are GMT -4. The time now is 5:57 AM.

Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2


For advertising opportunities click here.