2

Why is ember requesting XML instead of JSON?

XML Response according to firebug:

XML-processing defect: No element found address: moz-nullprincipal:{664ded3f-7063-4f92-b404-3895f595c584} Row No. 1, Column 1: [my translation into English]

Ember Data Request (Not Working)

Request Header:

Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8

Response Header:

Content-Type application/xml; charset=utf-8

Ajax Request (Working)

Request Header:

Accept application/json, text/javascript, /; q=0.01

Response Header:

application/json; charset=utf-8

My store and Adapter

App.store = DS.Store.create({
revision: 11,

});


DS.RESTAdapter.reopen({
  url: '.../json/ember'
});

My nested Model

App.Line = DS.Model.extend({
    lineIdentifier: DS.attr('string'),  
    shifts: DS.hasMany('App.Shift'),
});


App.Shift = DS.Model.extend({
    name: DS.attr('string'),
    line: DS.belongsTo('App.Line'), 
});

My WCF Interface

    [OperationContract]
    [WebInvoke(
        Method = "GET",
        ResponseFormat = WebMessageFormat.Json,
        UriTemplate = "/json/ember/lines"
        )]
    LinesArray LinesEmber();

My JSON

{
     "Line":[
            {"Shift":[{},{},{},{}],...},
            {"Shift":[{},{},{},{}],...}]
}

Well response would be fantastic, it's the last big coding step for my master thesis. :) Thanks in advance.

[Update]

Failed ember call: For me it's surprising, that ember requests xml... Failed ember call

Successful ajax call Successful ajax call

Finn MacCool
  • 808
  • 1
  • 7
  • 12
Daniel
  • 111
  • 1
  • 8
  • You can override the jquery ajax function like this: http://stackoverflow.com/questions/14828478/ember-js-ember-data-restadapter-fail-to-load-json/14828656#14828656 – albertjan Mar 21 '13 at 20:26
  • @alberjan: I added cors, according do this [tutorial](http://stackoverflow.com/questions/7234599/cors-support-within-wcf-rest-services). After modifying "adapter: DS.RESTAdapter.create({...})" according to your link, ember doesn't fire the option requests any longer. Only my ajax call got fired. Any additional ideas? Your support is appreciated! – Daniel Mar 22 '13 at 09:17
  • possible duplicate of [HTTP Headers setting Authorization header stops data from loading](http://stackoverflow.com/questions/19755570/http-headers-setting-authorization-header-stops-data-from-loading) – Paul Sweatte Apr 16 '14 at 19:44

0 Answers0