Hello,
I'm new to web services so I could use a little help.
I have a project that a web service will request data from me and I will respond with a web service giving the data. I've created the response web service as you can see below:
Person.cs
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace TestWebServices
- {
- public class Person
- {
- public string IdNo { get; set; }
- public string FirstName { get; set; }
- public string LastName { get; set; }
- }
- }
[WebMethod]
- [WebMethod(Description = "Return Applicants")]
- publicPerson[] retApplicants(String idno)
- {
- string connString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;SqlConnection connection = new SqlConnection(connString);
- SqlCommand command = new SqlCommand("selectApplicant", connection);
- command.CommandType = System.Data.CommandType.StoredProcedure;
- command.Parameters.Add("@idno", SqlDbType.VarChar).Value = idno;
- connection.Open();
- SqlDataReader reader = command.ExecuteReader();
- List
persons = new List (); - Person persReturned;
- while (reader.Read())
- {
- persReturned = new Person();
- persReturned.IDNO = reader["IdNo"].ToString();
- persReturned.FirstName = reader["FirstName"].ToString();
- persReturned.LastName= reader["LastName"].ToString();
- persons.Add(persReturned);
- }
- return persons.ToArray();
- }
How can I make it respond to the requested idno from the other web service?
Thank you in advance.

Praveen SreeramRank #134 · 16.8K reputationPosted Jun 29, 2016, 9:19 PM EDT
DealyRank #9,518 · 205 reputationPosted Jun 30, 2016, 4:00 AM EDT