Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When i try to use Web API service into my extjs application it gives me an error about Invalid HTTP status code 500 . Can anyone tell me why it give me this error. My store code is like :

C#
Ext.define(`Demo.store.Users`, {
    extend: `Ext.data.Store`,
    model: `Demo.model.User`,
    autoLoad: true,
    proxy: {
        type: `ajax`,
        api: {
            read: `http://<localhost>:50893/Api/EmployeeService`,
            update: `data/updateUsers'
        },

        reader: {
            type: `json`,
            root: `employee`,
            successProperty: `success`
        }
    }

});


error :

XML
OPTIONS http://<localhost>:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25 500 (Internal Server Error)
Ext.define.request Connection.js?_dc=1388125117581:358
Ext.define.doRequest Ajax.js?_dc=1388125117534:271
Ext.define.read Server.js?_dc=1388125117566:198
Ext.define.load AbstractStore.js?_dc=1388125117034:869
Base.implement.callParent ext-debug.js:4263
Ext.define.load Store.js?_dc=1388125117503:1552
(anonymous function) ext-debug.js:2085

OPTIONS http://<localhost>:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25 Invalid HTTP status code 500
Ext.define.request Connection.js?_dc=1388125117581:358
Ext.define.doRequest Ajax.js?_dc=1388125117534:271
Ext.define.read Server.js?_dc=1388125117566:198
Ext.define.load AbstractStore.js?_dc=1388125117034:869
Base.implement.callParent ext-debug.js:4263
Ext.define.load Store.js?_dc=1388125117503:1552
(anonymous function) ext-debug.js:2085

XMLHttpRequest cannot load http://<localhost>:50893/Api/EmployeeService?_dc=1388125117941&page=1&start=0&limit=25. Invalid HTTP status code 500


Thanks in Advance
Sandeep Tathe
Posted
Updated 31-Dec-13 19:16pm
v3
Comments
Sandeep K Tathe 29-Dec-13 22:49pm    
I trace the issue. When i create json file like :
{
"success":true,
"Employee":[
{"FirstName":"abc","LastName":"abc","Designation":"Student","Salary":142.2},
{"FirstName":"xyz","LastName":"xyz","Designation":"Computer Operator","Salary":1423.41}
]
}

it work fine. but when i call the data from web service it response data like :

[{"Id":2017,"FirstName":"abc","LastName":"abc","Designation":"Software Engineer","Salary":15000.0},{"Id":2018,"FirstName":"xyz","LastName":"xyz","Designation":"Student","Salary":15000.0}]

It not send object name along with the data. Can anyone tell me how can i send Object name with data in web api???

Thanks in Advance
Sandeep Tathe

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900