Well, i've created a web service in which the webmethod returns an array of String, when i access the web service it shows the values inside the array of String in the soap message, but when i access the array of String in the client web form it gives a Null Exception. The code for both the web service method and client code is as follows:
This is the web service method which returns an array of String
<WebMethod(EnableSession:=True)> _
Public Function SearchBySubject(ByVal subject As String) As String()
If isAuthenticated() Then
Dim bookTitles() As Object = PClient.ProxySearchBySubject(subject)
Dim count As Integer
count = bookTitles.Length
Dim titles(count) As String
Dim n As Integer
For n = 0 To count - 1
titles = CType(bookTitles, String)
Next
Return titles
End If
End Function
And this is the code in the client web form which calls the web service method
Dim srchItem, srchValue As String
Dim title(2) As String
Dim matches As Integer
srchItem = SearchList.SelectedValue
srchValue = SearchTxt.Text()
If srchItem.ToLower.Equals("subject") Then
title = service.SearchBySubject(srchValue)
End If
DataGrid1.DataSource = title
Me.DataBind()
errorLbl.Text = title(0)
When I debug and run it , the DataGrid is empty and it gives a Null Exception on the line
errorLbl.Text = title(0)
I will appreciate if any one can help me.
Thanx & Regards,
Fony
This is the web service method which returns an array of String
<WebMethod(EnableSession:=True)> _
Public Function SearchBySubject(ByVal subject As String) As String()
If isAuthenticated() Then
Dim bookTitles() As Object = PClient.ProxySearchBySubject(subject)
Dim count As Integer
count = bookTitles.Length
Dim titles(count) As String
Dim n As Integer
For n = 0 To count - 1
titles = CType(bookTitles, String)
Next
Return titles
End If
End Function
And this is the code in the client web form which calls the web service method
Dim srchItem, srchValue As String
Dim title(2) As String
Dim matches As Integer
srchItem = SearchList.SelectedValue
srchValue = SearchTxt.Text()
If srchItem.ToLower.Equals("subject") Then
title = service.SearchBySubject(srchValue)
End If
DataGrid1.DataSource = title
Me.DataBind()
errorLbl.Text = title(0)
When I debug and run it , the DataGrid is empty and it gives a Null Exception on the line
errorLbl.Text = title(0)
I will appreciate if any one can help me.
Thanx & Regards,
Fony