1. #1
    Sencha User
    Join Date
    Aug 2009
    Posts
    89
    Vote Rating
    1
    r4nd7263 is on a distinguished road

      0  

    Question ScriptTagProxy and JSONP wrapped XML response

    ScriptTagProxy and JSONP wrapped XML response


    Is it possible to use ScriptTagProxy to handle XML data wrapped in JSONP?


    Something like:
    Code:
    var store = new Ext.data.Store({
                model : 'MyModel',
                proxy : {
                    type : 'scripttag',
                    url : 'http://domain2/rest/jsonp/myModel/10000',
                    reader : {
                        type : 'xml',
                        record : 'MyModel'
                    }
                }
            })
    The server returns (with text/javascript):

    Code:
    stcCallback1001('<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<MyModel><id>10231<\/id><\/MyModel>')
    
    I tried and got this error: 'Uncaught TypeError: Cannot call method 'querySelectorAll' of null'

    Not sure if I didn't return the correct data format, or ScriptTagProxy simply can't handle XML data wrapped in JSONP response. Or something else went wrong.


  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    33,656
    Vote Rating
    436
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Why not use JSON then?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Aug 2009
    Posts
    89
    Vote Rating
    1
    r4nd7263 is on a distinguished road

      0  

    Default


    That's fine. I was wondering if ScriptTagProxy supported wrapped XML, just not yet documented.

    Our web service for native Android apps are serving XML in production, so I thought to reuse it that's all. If not, we will update it to support JSON as well

  4. #4
    Sencha User
    Join Date
    Feb 2011
    Posts
    57
    Vote Rating
    1
    Hertz is on a distinguished road

      0  

    Default


    If developing for iOS, and wrapping with Phonegap, you could just use Ext.Ajax and you don't have to worry about cross-domain policies.

    I do the testing with Safari on a mac (only browser and only platform to be able to test in my experience). But users won't have a problem accessing the info through your app in their devices, neither you while testing on the simulator with Xcode.

  5. #5
    Sencha User ilija139's Avatar
    Join Date
    Aug 2011
    Location
    Macedonia
    Posts
    36
    Vote Rating
    0
    ilija139 is on a distinguished road

      0  

    Default


    Thanks Hertz!