[CLOSED] HttpProxy sample with Method='GET' to load data for store

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] HttpProxy sample with Method='GET' to load data for store

    Hi,

    Could you please provide sample for how to use HttpProxy with method='GET'.

    All iam trying to do is on page load trying to load combobox using store, WebService method is been called from HttpProxy to load data in store, but the WebService method which is called to load data is accessing/using session which is not allowed if you method='POST' but if i change it to Method='GET' it throw "internal server error - status code 500".

    Note im using coolite version 0.8.

    Added this thread by mistake in place, could you please delete them?
    http://forums.ext.net/showthread.php...ing-New-Topics
    http://forums.ext.net/showthread.php...data-for-store

    Thanks.
    Last edited by Daniil; Feb 08, 2011 at 2:20 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Here is the example for Ext.Net with Method="GET".

    https://examples1.ext.net/#/GridPane.../ServiceUsing/

    The same example for 0.8.X you can find in Coolite sources:

    <SVN folder>\Coolite.Examples\Examples\GridPanel\WebService_Connections\ServiceUsing\Default.aspx
    Last edited by geoffrey.mcgill; Feb 20, 2011 at 12:19 PM.
  3. #3
    Hi,

    To understnad the problem which you have with WebService please see the response from the service (use Fiddler or FireBug)
  4. #4
    Thanks, the error i get is "{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}" both in browser as well in fiddler, this happen only if Method='GET' if i change back to 'POST' i dont get this error.

    All i need to do is on 'GetAllData' method for the very first time when it fetches data from server i want to persis it in session just to avoid roundtrip call to server.

    Here is my code

    <ext:Store ID="OperatorStore" runat="server" AutoLoad="True">
        <Proxy>
            <ext:HttpProxy Json="true" Method="GET" Url="/_vti_bin/SPFramework/TestService.asmx/GetAllData" />
        </Proxy>
        <Reader>
            <ext:JsonReader ReaderID="OperatorStoreReader" Root="d">
                <Fields>
                    <ext:RecordField Name="OperatorId" />
                    <ext:RecordField Name="OperatorCode" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Listeners>
            <DataChanged Handler="SelectCurrentOperator();" />
            <LoadException Handler="var e = e || {message: response.responseText}; alert('Load failed: ' + e.message);" />
            <SaveException Handler="alert('save failed');" />
            <CommitDone Handler="alert('commit success');" />
            <CommitFailed Handler="alert('Commit failed\nReason: '+msg)" />
        </Listeners>
    </ext:Store>
    <div style="margin-bottom: 1px;">
        <ext:ComboBox ID="OperatorCombo" Width="228" runat="server" EmptyText="Select Operator..."
            StoreID="OperatorStore" DisplayField="OperatorCode" ValueField="OperatorId">
            <Listeners>
                <Select Handler="UpdateCurrentOperator(#{OperatorCombo}.getValue(),#{OperatorCombo}.getRawValue())" />
            </Listeners>
        </ext:ComboBox>
    </div>
    Last edited by Daniil; Feb 07, 2011 at 2:35 PM. Reason: Please use [CODE] tags
  5. #5
    Hi,

    Do you use JSON (script) web service?
    If yes then you have to set Json="true" for proxy
    Also, I guess that your web service decline GET requests
    Try to add to web method
    [ScriptMethod(UseHttpGet = true)]
  6. #6
    Thanks, I did not had UseHttpGet=true, after adding this i get different error than before it throws "401 Unauthorized", if i remove the line of code which adds the data into session its fine. Below is my webservice method.

    [WebMethod(EnableSession = true)]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = true)]
    public List<Operator> GetAllOperator()
    {
    List<Operator> ops = null;
     
    ops = _securitySvcBroker.UserService.GetAllAccessibleOperator();
    Session.Add("ops", ops);
     
    return ops;
    }
    Last edited by Daniil; Feb 07, 2011 at 2:36 PM. Reason: Please use [CODE] tags
  7. #7
    Hi,

    Did you mark service as script service (ScriptService attribute)?
  8. #8
    Yes, it has got following attributes
    [WebService(Namespace = "http://test.co.uk/webservice/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    Last edited by Daniil; Feb 08, 2011 at 7:52 AM. Reason: Please use [CODE] tags
  9. #9
    All i have to do is serialize [Serializable()] the object :-)

    Thanks for your help.
  10. #10
    Hi inayath,

    Please clarify is the problem solved?
Page 1 of 2 12 LastLast

Similar Threads

  1. [CLOSED] Export store data to Excel using HttpProxy
    By ecko in forum 1.x Legacy Premium Help
    Replies: 12
    Last Post: Dec 15, 2011, 11:54 AM
  2. Replies: 6
    Last Post: Jul 15, 2011, 1:03 PM
  3. [CLOSED] HttpProxy sample with Method='GET' to load data for store
    By inayath in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Feb 07, 2011, 11:55 AM
  4. [CLOSED] Ext.data.store.load()
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 01, 2010, 10:24 PM
  5. Store data does not load in panel's field.
    By ankit in forum 1.x Help
    Replies: 0
    Last Post: May 25, 2010, 8:44 AM

Posting Permissions