Results 1 to 7 of 7

Thread: How to connect to a web service

  1. #1

    Default How to connect to a web service

    hi all,

    I am a new newbie and wanted to connect to a web service. how do I do that. Any tips and examples?
    Thanks.

  2. #2
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    The same way as you would with any other framework, just make an Ajax request and pass the appropriate parameters. There's examples under /examples/ajax
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  3. #3

    Default

    thanks for the quick reply, but it seems that the /examples/ajax has been removed. could anyone pls post a sample ajax request for me to study. I am relatively new to this and would appreciate extra help. Thanks.

  4. #4
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  5. #5

    Default

    hi Evant,

    I would like to know how to fix the error in the example when I click on the button of the xmlhttprequest it shows Origin null is not allowed by Access-Control-Allow-Origin.

    How can I allow cross domain access control allow origin? I'm accessing a web service outside the domain that loads it.

    Thanks.

  6. #6

    Default

    I can now get the request on the web service using ext.util.jasonp.request. But I'm having a problem now on how I can read the response and assign it on a variable. Please help, thanks.

    Quote Originally Posted by msubscribe View Post
    hi Evant,

    I would like to know how to fix the error in the example when I click on the button of the xmlhttprequest it shows Origin null is not allowed by Access-Control-Allow-Origin.

    How can I allow cross domain access control allow origin? I'm accessing a web service outside the domain that loads it.

    Thanks.

  7. #7

    Default

    This is the way I do it:

    Code:
    var con = new Ext.data.Connection();
                con.request({
                    url: 'update', // where to do the request
                    jsonData: jsonData, // << key value object with data to send 
                    method: 'GET',
                    callback: function(opts, success, response)  {
                        if (!success) {
                            Ext.MessageBox.alert("Error", 
                             "Error retrieving data - try again");
                            return;
                        }
                        //use the answer of the request, which is contained in response.responseText
                        alert(response.responseText)            
                    }
                
                });

Similar Threads

  1. Connect to .NET WCF web Service
    By Roby in forum Ext GWT: Discussion
    Replies: 17
    Last Post: 19 Sep 2011, 6:49 AM
  2. Web service and XML
    By swissmade in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 14 Jul 2010, 3:49 AM
  3. Web Service for TreePanel loader?
    By TomKohl in forum Ext 1.x: Help & Discussion
    Replies: 4
    Last Post: 20 Sep 2007, 12:31 PM
  4. [SOLVED]C# Web Service and grid
    By Deleter in forum Ext 1.x: Help & Discussion
    Replies: 14
    Last Post: 12 Sep 2007, 4:22 AM
  5. SOAP Web Service
    By SmyersM in forum Ext 1.x: Help & Discussion
    Replies: 5
    Last Post: 10 Apr 2007, 3:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •