Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6145325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:46:41+00:00 2026-05-23T18:46:41+00:00

I have the following web-service: <%@ WebService Language=VB Class=WebService %> Imports System.Web Imports System.Web.Script.Services

  • 0

I have the following web-service:

<%@ 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

But it is returning:

{"d":[{"FirstName":null,"LastName":null},{"FirstName":null,"LastName":null}]}

It should be returning:

{"d":[{"FirstName":"firstname_1","LastName":"surname_1"},{"FirstName":"firstname_2","LastName":"surname_2"}]}

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T18:46:43+00:00Added an answer on May 23, 2026 at 6:46 pm

    You never assing FirstName and LastName in the constructor, so their values will stay null.
    Add the following to your constructor:

    FirstName = m_FirstName
    LastName = m_LastName
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following web service: [ScriptService] public class Handler : WebService { [WebMethod]
I currently have the following code: <%@ WebService Language=C# Class=Notifications %> using System; using
I have the following JSON coming back from a web service which I am
I have the following xml that's sent to me from a web service. I'm
I have the following web service that allows me uploading files: [WebService(Namespace = http://tempuri.org/)]
I have an web service named AEWService.asmx with the following code: using System; using
Suppose I have the following (rather common) model Client invokes web service request ->
I have been following a couple of articles regarding RESTful web services with WCF
Say I have the following web.config: <?xml version=1.0 encoding=utf-8?> <configuration> <system.web> <authentication mode=Windows></authentication> </system.web>
I have written a simple WCF web service in C# which returns records from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.