0
I次のWebサービスがあります。Webサービスがnullを返すのはなぜですか?
<%@ WebService Language="VB" Class="WebService" %>
Imports System.Web
Imports System.Web.Script.Services
Imports System.Web.Services
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class WebService
Inherits System.Web.Services.WebService
Public Class Person
Public FirstName As String
Public LastName As String
Public Sub New(ByVal m_FirstName As String, ByVal m_LastName As String)
End Sub
End Class
<ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
<WebMethod()> _
Public Function GetPersons() As List(Of Person)
Dim lst As List(Of Person) = New List(Of Person)
lst.Add(New Person("firstname_1", "surname_1"))
lst.Add(New Person("firstname_2", "surname_2"))
Return lst
End Function
End Class
しかし、それは戻っている:
{"d":[{"FirstName":null,"LastName":null},{"FirstName":null,"LastName":null}]}
それは返すべきである:
{"d":[{"FirstName":"firstname_1","LastName":"surname_1"},{"FirstName":"firstname_2","LastName":"surname_2"}]}
私が間違っているのは何を?
それでした!ありがとう。 – oshirowanen