[CLOSED] web service problem

  1. #1

    [CLOSED] web service problem



    Hi,

    how to use web service in coolite. I have tried but the page show error.
    My code as follow.

    this code is from aspx page.
    
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="FrmLogin.aspx.cs" Inherits="_Default" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title></title>
    </head>
    <body>
    <form id="form1" runat="server">
    
    <ext:ScriptManager ID="ScriptManager1" runat="server">
    </ext:ScriptManager>
    <ext:Store ID="Store1" runat="server">
    <Proxy>
    <ext:HttpProxy Method="POST" Json="true" Url="/InfoService.asmx/GetAllInformation" />
    </Proxy>
    <Reader>
    <ext:XmlReader>
    <Fields>
    <ext:RecordField Name="INFORMATION_TYPE_NO">
    </ext:RecordField>
    <ext:RecordField Name="INFORMATION_TYPE_DESC">
    </ext:RecordField>
    </Fields>
    </ext:XmlReader>
    </Reader>
    <Listeners>
    <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>
    <ext:GridPanel ID="GridPanel1" StoreID="Store1" runat="server">
    <ColumnModel>
    <Columns>
    <ext:Column DataIndex="INFORMATION_TYPE_NO" Header="No">
    </ext:Column>
    <ext:Column DataIndex="INFORMATION_TYPE_DESC" Header="Info Desc">
    </ext:Column>
    </Columns>
    </ColumnModel>
    </ext:GridPanel>
    
    
    </form>
    </body>
    </html>
    
    
    in asmx page the code as follows
    
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Services;
    using System.Data;
    [WebService]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.Web.Script.Services.ScriptService]
    public class InfoService : System.Web.Services.WebService {
    public InfoService () { 
    }
    [WebMethod]
    public DataSet GetAllInformation()
    {
    string LStrQuery = "select information_type_no,information_type_desc from information where area='E'";
    DataSet dsinfo = data.GetDataSet(LStrQuery);
    return dsinfo;
    }
    }
    there is no code written in aspx.cs page.
  2. #2

    RE: [CLOSED] web service problem

    Hi,

    Please see the following sample which demonstrate how to get data from web-service
    https://examples1.ext.net/#/GridPane...reCustomLogic/


    1. Why do you set Json="true" for HttpProxy? It is required for JSON WebService (which return JSON instead XML). Does your service return JSON? If yes then why do use XmlReader, if no then remove Json="true"


    2. You need specify Record property for XmlReader
    The DomQuery path to the repeated element which contains record information.
    See web-service response to determine Record property (for example open web-service in browser and run required function, see xml)
  3. #3

    RE: [CLOSED] web service problem

    Hi,

    I have changed the xmlreader




    <Proxy>
    <ext:HttpProxy Method="POST" Url="/InfoService.asmx/GetAllInformation" />
    </Proxy>



    <ext:XmlReader Record="INFORMATION_TYPE_NO">
    <Fields>
    <ext:RecordField Name="INFORMATION_TYPE_NO"></ext:RecordField>
    <ext:RecordField Name="INFORMATION_TYPE_DESC"></ext:RecordField>
    </Fields>
    </ext:XmlReader>but still i get error please see attachment how to solve this.
  4. #4

    RE: [CLOSED] web service problem

    Hi,

    You have 404 error. It is mean that you specified incorrect URL. Why do you have a slash ('/') at start of url. Does your web-service placed in the root of site? Try to remove it.


    Also you have incorrect Record in XmlReader. You have to specified repeating tag which contains data item (it depends from data, just see response XML to determine Record tag)


    Also I am doubt that using DataSet as WebService reponse is efficient (large amount of superfluous data)
    See http://www.theserverside.net/tt/arti...Top5WSMistakes

Similar Threads

  1. Need Help Using a Web Service !
    By metallica87 in forum 1.x Help
    Replies: 2
    Last Post: Mar 19, 2012, 3:25 AM
  2. Problem CRUD with JSON&Web Service
    By oseqat in forum 1.x Help
    Replies: 1
    Last Post: Jul 12, 2011, 10:23 AM
  3. Problem With Internet Information Service(IIS).
    By nadiepornadie in forum 1.x Help
    Replies: 2
    Last Post: Jan 18, 2011, 12:01 AM
  4. [CLOSED] Highcharts problem with JSON Store which connect to web service.
    By farisqadadeh in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 03, 2011, 9:38 AM
  5. [CLOSED] Need Help Using a Web Service with a Grid
    By iansriley in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Dec 23, 2008, 9:15 AM

Posting Permissions