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.
DealyPosted Jun 30, 2016, 8:00 AM
Praveen SreeramPosted Jun 30, 2016, 1:19 AM