1. #1
    Touch Premium Member
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    386
    Vote Rating
    7
    marc.fearby is on a distinguished road

      0  

    Question Firebug shows six requests for json store

    Firebug shows six requests for json store


    I've recently created a very basic web service in WCF REST .NET 4 which, when loaded, simply outputs a JSON array of objects (no root element at this point). When I design a form with a combo box on it with an auto-loaded Json Store, when I load the designer.html in Firefox, there are four GET requests at first, one of which does get the JSON data, and when I click the trigger in the combo box, there are two more. A picture of the Firebug console is attached.

    I've been mired in ASP.NET WebForms rubbish of late, so my Ext skills have rusted a tad, so I might have done something wrong here, but I'm now free (for now) from that mess so I'm keen to get back into ExtJS. I don't think that six GET requests is normal. I've also attached the designer output in a ZIP file.

    Thanks.
    Attached Images
    Attached Files

  2. #2
    Touch Premium Member
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    386
    Vote Rating
    7
    marc.fearby is on a distinguished road

      0  

    Default


    After upgrading my IE to version 9 and installing the .NET 4 latest version of Fiddler2, I noticed the responses a bit more and it does seem as though it's to do with my first-attempt at a WCF REST service and authorisation. When I figure it out I'll post back here in case anybody else happens to encounter this "problem". The docs on WCF REST WebHttp services aren't that beginner friendly, I have to say.

    I still need to figure out why the combo trigger is sending another GET request, though.

  3. #3
    Touch Premium Member
    Join Date
    Sep 2011
    Location
    Tamworth, NSW, Australia
    Posts
    386
    Vote Rating
    7
    marc.fearby is on a distinguished road

      0  

    Default


    I set queryMode to 'local' on the combo box so I'm now only seeing 4 and not six requests in Firebug. I think that WCF REST services must rely in sending redirection headers (as shown via Fiddler in IE, whereas Firefox just shows 401 then 200 and not 307 then 200), which might explain why I'm still seeing 4. First two are to authenticate (I turned off anonymous authentication, though for my own testing locally I could probably dispense with that, since my AppPool identity is running as me anyway, so that I can connect to a SQL Server) and the second two are the redirect and the data.

    This change to RESTful services is going to take some getting used to, but I can see the benefits in terms of having a well-structed setup instead of the spaghetti code I might otherwise have been tempted to write.

    Incidentally, I kept getting 400 bad request errors trying to PUT a JSON object to my service until I discovered that I had to set the content-type header. Here's the ExtJS in case anybody has the same (nightmarish!) problem and discovers this solution:

    PHP Code:
            var campus = {"Description":"My Campus","ID":0};
            
    Ext.Ajax.request({
                
    url'http://localhost/WcfRestService1/Campus/777',
                
    method'PUT',
                
    headers: { 'Content-Type''application/json''Accept''application/json' },
                
    jsonDatacampus,
                
    success: function(response){
                    var 
    text response.responseText;
                    
    alert('Response: ' text);
                },
                
    failure: function(response) {
                    
    alert('failure');
                }
            }); 
    Even though I have defaultOutgoingResponseFormat="Json" against the standardEndPoint in my web.config, I thought I'd also send an Accept header for the fun of it. I don't ever want anybody I work with thinking XML is a good idea :-)

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar