using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net;
using System.Text;
using System.IO;
using System.Web.Services;
using System.Web.Script.Services;
using System.Web.Script.Serialization;
using Newtonsoft.Json.Linq;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
getarticlelist();
}
private void getarticlelist()
{
StringBuilder str = new StringBuilder();
string url = "Put your Service url";
WebRequest request = WebRequest.Create(url);
using (WebResponse response = (HttpWebResponse)request.GetResponse())
{
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
string json = reader.ReadToEnd();
var serializer = new JavaScriptSerializer();
var objects = JArray.Parse(json);
str.Append("<table>");
foreach (JObject root in objects)
{
string id = "";
string title = "";
string date = "";
string longdesc = "";
foreach (KeyValuePair<String, JToken> app in root)
{
if (app.Key == "id") id = app.Value.ToString();
if (app.Key == "title") title = app.Value.ToString();
if (app.Key == "date") date = app.Value.ToString();
if (app.Key == "longdesc") longdesc = app.Value.ToString();
}
str.Append("<tr><td><h1>" + title + "</h1></td></tr>");
str.Append("<tr><td>" + date + "</td></tr>");
str.Append("<tr><td>" + longdesc + "</td></tr>");
}
str.Append("</table>");
//---------Social Sharing
divShare.InnerHtml = str.ToString();
}
}
}
}
//-------aspx code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div id="divShare" runat="server">
</div>
</form>
</body>
</html>
//-------------
I think this your solution for calling WebService with c# .
Check this Code.