zlarson
5 Oct 2007, 7:36 AM
I have looked all through these forums for the past two days and tried applying everything i found with no luck so i thought i would post my situation:
This is my javascript that calls my web service:
(I have tempData and the use of a memoryProxy just to prove my problem is with the HttpProxy, it works fine when i use the MemoryProxy. When i use the HttpProxy the loadexception event is fired.)
var dropdownRecord = new Ext.data.Record.create([
{name:'id'},
{name:'text'}
]);
//tempData is used to show that a memoryProxy will work
var tempData = {'results':2, 'rows':[{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]};
/* datastore for dropdown */
var dsDropDown = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'Services/WebService.asmx/GetDropDown'}),
//proxy: new Ext.data.MemoryProxy(tempData),
reader: new Ext.data.JsonReader({totalProperty:'results', root:'rows', id:'id'}, dropdownRecord)
});
dsDropDown.on('beforeload', function() {
dsDropDown.baseParams = {type:'STAT'};
});
dsDropDown.on('loadexception', function(){
alert('exception!');
});
dsDropDown.on('load', function(){
alert('loaded');
});
dsDropDown.load();
This is my web service setup:
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Web.Script.Services;
namespace CurrentContents
{
[WebService(Namespace = "http://microsoft.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService
{
private CurrentContents.DbWorker worker = null;
public WebService()
{
worker = new DbWorker();
}
[WebMethod(Description = "returns a JSON string of dropdown items")]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetDropDown( string type )
{
//return worker.GetDropdown(type);
return "{'results':7, 'rows': [{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]}";
}
............
When i go to my wsdl and invoke this method i see:
(I would expect to be seeing just a string and not my string wrapped in xml?)
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://microsoft.com/webservices/">{'results':2, 'rows': [{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]}</string>
What am i doing wrong?
Thanks.
This is my javascript that calls my web service:
(I have tempData and the use of a memoryProxy just to prove my problem is with the HttpProxy, it works fine when i use the MemoryProxy. When i use the HttpProxy the loadexception event is fired.)
var dropdownRecord = new Ext.data.Record.create([
{name:'id'},
{name:'text'}
]);
//tempData is used to show that a memoryProxy will work
var tempData = {'results':2, 'rows':[{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]};
/* datastore for dropdown */
var dsDropDown = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'Services/WebService.asmx/GetDropDown'}),
//proxy: new Ext.data.MemoryProxy(tempData),
reader: new Ext.data.JsonReader({totalProperty:'results', root:'rows', id:'id'}, dropdownRecord)
});
dsDropDown.on('beforeload', function() {
dsDropDown.baseParams = {type:'STAT'};
});
dsDropDown.on('loadexception', function(){
alert('exception!');
});
dsDropDown.on('load', function(){
alert('loaded');
});
dsDropDown.load();
This is my web service setup:
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml;
using System.Web.Script.Services;
namespace CurrentContents
{
[WebService(Namespace = "http://microsoft.com/webservices/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[ScriptService]
public class WebService : System.Web.Services.WebService
{
private CurrentContents.DbWorker worker = null;
public WebService()
{
worker = new DbWorker();
}
[WebMethod(Description = "returns a JSON string of dropdown items")]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetDropDown( string type )
{
//return worker.GetDropdown(type);
return "{'results':7, 'rows': [{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]}";
}
............
When i go to my wsdl and invoke this method i see:
(I would expect to be seeing just a string and not my string wrapped in xml?)
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://microsoft.com/webservices/">{'results':2, 'rows': [{'id':1, 'text':'New'},{'id':2, 'text':'In Progress'}]}</string>
What am i doing wrong?
Thanks.