Consume PHP Soap Web Service in ASP.Net

on Nov 30, 2015 02:38 AM


I want to call php web service in which retrun response in Json formate and I want to bind this response to gridview control.

How it is possible please guide me.



Thank you,

Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Nov 30, 2015 04:26 AM

You can do like this

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.Web.Script.Serialization;

public partial class Default2 : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)
        WebClient wb = new WebClient();
        //Place your php url here
        string s = wb.DownloadString("");
        JavaScriptSerializer serializer = new JavaScriptSerializer();
        List<RootObject> records = serializer.Deserialize<List<RootObject>>(s);
        GridView1.DataSource = records;

    //generate classes using json to c#
    public class RootObject
        public int userId { get; set; }
        public int id { get; set; }
        public string title { get; set; }
        public string body { get; set; }


<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <form id="form1" runat="server">
        <asp:GridView ID="GridView1" runat="server"></asp:GridView>

Try you will get the result