1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    hengboyz is on a distinguished road

      0  

    Default Answered: OPTIONS (url) 405 (Method Not Allowed)

    Answered: OPTIONS (url) 405 (Method Not Allowed)


    Sorry if i ask a strange question as i am still new to Sencha Touch.I am facing a problem of the request method of Ajax Proxy in store always OPTIONS which cannot access my web service method, as the web service method is set to GET.Here is my code:

    Code:
    [WebInvoke(Method="GET", UriTemplate="GetCoupons",ResponseFormat=WebMessageFormat.Xml)]
           public List GetCoupons()        {
               List rs = db.MMCO_sp_GetCoupons(null, null, 1).ToList();
               foreach (MMCO_sp_GetCouponsResult temp in rs) 
               { 
                   couponList.Add(new Coupon(temp.coupon_code);
               }
               return couponList;
           }
    Code in sencha:
    Code:
    Ext.define("Next2Me.store.Coupons", {
        extend: "Ext.data.Store",
            config: {
            model: "Next2Me.model.Coupon",
            autoLoad: true,
            root: {
                expanded: true
            },
            proxy: {
               type: 'ajax', 
               url: 'http://localhost:11827/CouponJSON.svc/web/GetCoupons',
               reader: {
                   type: 'xml' 
               }
           }
        }
    })
    Error:

    Untitled.jpg
    Return of Web Service Method:

    Untitled.jpg

  2. You are trying to use ajax cross-origin which doesn't work. You can try using CORS (not currently supported within ST2) and this is the reason you are seeing the OPTIONS request. The browser first sends this request to see if the server supports CORS in order to allow the ajax fire cross-origin.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    You are trying to use ajax cross-origin which doesn't work. You can try using CORS (not currently supported within ST2) and this is the reason you are seeing the OPTIONS request. The browser first sends this request to see if the server supports CORS in order to allow the ajax fire cross-origin.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  4. #3
    Sencha User
    Join Date
    Jan 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    hengboyz is on a distinguished road

      0  

    Default


    Thanks. So what should be the solution since cors not supported st2. Any suggestion ?

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    35,704
    Answers
    3356
    Vote Rating
    750
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    JsonP is the only other route but requires you to return JSON within a callback function.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    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 in print!

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

  6. #5
    Sencha User
    Join Date
    Jan 2012
    Posts
    14
    Answers
    1
    Vote Rating
    0
    hengboyz is on a distinguished road

      0  

    Default


    Thanks a lot, buddy.

    I solved my problem with JsonP.

  7. #6
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    SpadarShut is on a distinguished road

      0  

    Default


    So how do I do authorization when ST2 doesn't support CORS and I can't do POST requests with JSONP to send login/pass?

  8. #7
    Sencha User
    Join Date
    Mar 2012
    Location
    The Netherlands
    Posts
    75
    Answers
    13
    Vote Rating
    4
    SebasSP is on a distinguished road

      0  

    Default


    You can run a server-side script which acts as a proxy for all calls.

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