I'm trying to connect to a VB.net web service (ASMX) written in visual studio 2013 from a new Windows 8 Phone app VB.net written in visual studio 2015 community edition passing data between the two via JSON.
I think the web service is working okay and I get the following response when running it in the browser and clicking invoke:-
<string xmlns="http://SERVERNAME/">
[{"picksheet":"37760","seq":"24"},{"picksheet":"63245","seq":"20"},{"picksheet":"63818","seq":"23"},{"picksheet":"72162","seq":"16"}]
</string>
I seem to be able to get the actual JSON response back in the windows phone 8 app via the following code:-
Dim httpClient As HttpClient = New System.Net.Http.HttpClient()
Dim request As New HttpRequestMessage(HttpMethod.[Get], "http://WebServiceIPAddress/WebServices.asmx/GetPicksheetsAsJSON")
Dim response As HttpResponseMessage = Await httpClient.SendAsync(request)
If response.StatusCode = Net.HttpStatusCode.OK Then
Dim json As String = response.Content.ReadAsStringAsync.Result.ToString
'POPULATE THE CLASS HERE
End If
My intention is to populate a class of picksheets from the above data, then iterate through them as necessary:-
Public Class clsPicksheets
Private _Picksheet As String
Private _Seq As String
Public Property Picksheet() As String
Get
Return _Picksheet
End Get
Set(value As String)
_Picksheet = value
End Set
End Property
Public Property Seq() As String
Get
Return _Seq
End Get
Set(value As String)
_Seq = value
End Set
End Property
End Class
Getting the JSON data into the picksheets class is where I'm having trouble, I've tried numerous methods after googling the issue, but still no joy after 2 days.
An example of the above working with a means to iterate through each picksheet is what I'm after ultimately.
Forgive me if the following is a simple fix, but I've not had any experience with Web Services, C# (which seems to be what all the examples I've found are written in), Windows Phone 8 development or JSON data. :-(
Any help would be greatly appreciated to this first post to SO.
Many Thanks for any responses.