Click here to Skip to main content
14,830,769 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello ,

I read some articles on web about how to consume a REST function. Now I am trying to create a function that will consume xml from webrequest/response.

I know how to consume such a function but don't know how to create one.
Please tell me how to create such a function

I want to send xml in webrequest from client. I need to create a function that will consume this xml from client at server. Please help ..
Nearly all in ASP.NET is about "consumption" of HTTP request/response data. Could you please explain the problem in detail? Start with explanation of the ultimate goals. Why XML, what's the purpose of it? And so on...
Aakash Sharma 12-Mar-15 2:49am
I am creating a RESTFULL service. Client will upload records (millions of rows) consuming this service. I am trying to create a function that will consume xml that client will send in a stream.

1 solution

You can create webservice(.asmx) like this one

/// <summary>
/// Summary description for GetDataWebService
/// </summary>
[WebService(Namespace = "")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class GetDataWebService : System.Web.Services.WebService

    BooksDBEntities db = new BooksDBEntities();

    public string HelloWorld()
        return "Hello World";

    public List<studentserialized> GetAllStudentData()
        List<student> lststu = new List<student>();
        lststu = db.Students.ToList();
        List<studentserialized> lstss = new List<studentserialized>();
        foreach (Student sss in lststu)
            StudentSerialized ss = new StudentSerialized();

            ss.ID = sss.ID;
            ss.Name = sss.Name;
            ss.Roll = sss.Roll;


        return lstss;


  public  class StudentSerialized
        public int ID { get; set; }
        public string Name { get; set; }
        public string Roll { get; set; }



This function(GetAllStudentData)  will return an XML.

<arrayofstudentserialized xmlns:xsi="" xmlns:xsd="" xmlns="">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900