PDA

View Full Version : what is the correct request format?



flyzb
26 Nov 2007, 1:37 AM
my orm framework is genome ,and my asp.net ajax webserviece code is below:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
[ToolboxItem(false)]
public class RoleService : System.Web.Services.WebService
{

[WebMethod]
[ScriptMethod( ResponseFormat = ResponseFormat.Xml, UseHttpGet =true )]
public RoleDtoCollection GetRoles()
{
using (ctx.Push(ReadOnlyContext.Create()))
{
Set Roles = Helper.DB.Extent(typeof(Role));
return RoleSerializer.SerializeRoleFull(Roles);
}
}
}

and my extjs store code is below:

this.store = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
method:'get',
url: '/Services/Login/RoleService.asmx/GetRoles'
}),

reader: new Ext.data.XmlReader({
// records will have an "Item" tag
record: 'RoleDto'
}, [
{name:'Id'},
{name:'Name'},
{name:'Description'},
{name:'Order'}
])

})
});


and my webservice request xml result is below:

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfRoleDto xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<RoleDto>
<Data>
<Description/>
<Name>webAdmin</Name>
</Data>
</RoleDto>
</ArrayOfRoleDto>

but I got the erro:


Request format is unrecognized for URL unexpectedly ending in '/GetRoles'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/GetRoles'.

so I debug the extjs,and found the erro here:


asyncRequest:function(I,F,H,E){
.....
G.conn.send(E||null);
return
}


so I want to know that what is correct request format of ExtJs?

shibubh
26 Nov 2007, 2:50 AM
hi flyzb
i dont why you want this. because it is very simple to call the asp.net web service method from Extjs code.

tryanDLS
26 Nov 2007, 8:51 AM
Use the ext-all-debug.js file so you can read what that code is doing.

26 Nov 2007, 9:57 AM
flyzb,
Welcome to the EXTJS community :)


please post in [code] or [php] tags in the future.

flyzb
27 Nov 2007, 2:56 AM
I have found the answer:
In web.config, add 'HttpGet=true' and 'HttpPost=true', so you can get correct result of asp.net ajax webservice by the way httpproxy.