Forum guidelines
Roy r
Load web service response in Sencha touch data store..
Posted By Roy r on 02 May 2011

My Web Service code is as follows :

public class DemoService : System.Web.Services.WebService

public string HelloWorld()
return "Hello World";

[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
public string Test()
string str = "[{\"username\":\"Admin\",\"first_name\":\"Admin\",\"last_name\":\"istrator\",\"initials\":\"ADM\"}]";
return str;

[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true, XmlSerializeString = false)]
public Alert[] GetAlerts()
Alert[] p = new Alert[2];
p[0] = new Alert(1, "1aadd", "ddd");
p[1] = new Alert(2, "2aadd", "aaaa");
return (p);

public class Alert
public string Name { get; set; }
public string Description { get; set; }
public int ID { get; set; }

public Alert() { }

public Alert(int Key, string firstname, string lastname)
ID = Key;
Name = firstname;
Description = lastname;

Now I want to call GetAlerts() method using ajax call .So I added following code...

method: 'post',
url: 'http://localhost:5467/Service.asmx/GetAgents',
success: function (response, request) {
failure: function (response, request) {
alert('uh-oh! - hit')

But it is returning XML instead of JSON.Why it is returning Xml and How can I get JSON ?

Now I wanted to load data in store and wanted to display it in List ..


fullscreen: true,
glossOnIcon: false,
onReady: function () {

Ext.regModel('User', {
fields: [{
name: 'AgentID'
}, {
name: 'FirstName'
}, {
name: 'LastName'

var xmlstore = new{
model: 'User',
method: 'POST',
proxy: {
url: 'http://localhost:5467/Service.asmx/GetAgents',
type: 'ajax',
reader: {
type: 'xml',
root: 'DocumentElement',
record: 'match'


var xmlList = new Ext.List({
title: 'xmlList',
fullscreen: true,
itemSelector: '.match',
itemTpl: '<tpl for="."><div class="match">{FirstName} {LastName}</div></tpl>',
store: xmlstore

var p = new Ext.TabPanel({
fullscreen: 'true',
items: [xmlList]


But its not working...

If anyone know Please tell me how to get it working ??

Or how can I load XML data in DataStore ?

Re: Load web service response in Sencha touch data store..
Posted By Shirsendu Nandi on 02 May 2011  
Use xlinq.I think it is an bson document.u go for xnl linq.and set the value in to the dataset

Shirsendu B Nandi

Snr.Software Engineer in Marlabs Software

Re: Load web service response in Sencha touch data store..
Posted By natarajan Govindavel on 11 Apr 2012  
Hi friend,
 I think you can use return new JavaScriptSerializer().Serialize(p ); instead of return(p); you will get response in the json format...

C# Corner Annual Conference 2016


Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.