2 Replies Latest reply on May 1, 2009 9:59 AM by emiliovick

    Error trying to consume a ASP.NET Web Service


      Good evevning to the community


      I have a web Service thats request information from the database and display the Records in XML




      <strstore_id>701       </strstore_id>

      <strstore_id>702       </strstore_id>

      <strstore_id>703       </strstore_id>



      I try by this Program to load the Data from The Service but it give me error



      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
          backgroundGradientColors="[0xFFFFFF, 0xFFFFFF]">


                      import mx.controls.Alert;
                      import mx.rpc.events.FaultEvent;
                      import mx.rpc.events.ResultEvent;
                      import mx.rpc.soap.mxml.WebService;
                      import mx.managers.CursorManager;

                      * @bindable
                      * @private
                      * @property Will hold the data passed from the web service.
                      private var _xmlData:XML;

                      * @private
                      * Connects and calls the getPlayers() method from our web service.
                      private function clickHandler(event:MouseEvent):void
                          event.target.enabled = false;

                          var service:WebService = new WebService();
                          service.addEventListener(ResultEvent.RESULT, serviceResultHandler);
                          service.addEventListener(FaultEvent.FAULT, serviceFaultHandler);

                      * @private
                      * Stores the loaded data in an XML object and displays the DataGrid.
                      private function serviceResultHandler(event:ResultEvent):void
                          _xmlData = XML(event.result);
                          this.dataGrid.visible = true;

                      * @private
                      * Displays any possible errors that might occur when
                      * trying to connect to our web service.
                      private function serviceFaultHandler(event:FaultEvent):void
                          Alert.show(String(event.fault), "Error");
                          this.loadBtn.enabled = true;


              <mx:VBox horizontalCenter="0" verticalCenter="0"
                     horizontalScrollPolicy="off" verticalScrollPolicy="off">

                     <mx:Button id="loadBtn" label="Load/Display Data" width="700"
                     <mx:DataGrid id="dataGrid" width="100%" height="200"
                         visible="false" dataProvider="{_xmlData.*}">
                             <mx:DataGridColumn headerText="ID"
                                 dataField="strTitleName" width="30"/>
                             <mx:DataGridColumn headerText="Name"
                                 dataField="strstore_id" width="120"/>
                             <mx:DataGridColumn headerText="Score"
                                 dataField="strvoucher_id" width="70"/>




      Message Error Box





      Thanks in Advance for any help with this problem


        • 1. Re: Error trying to consume a ASP.NET Web Service
          Gregory Lafrance Level 6

          What is this "input" referred to in the error message? It does not seem to be in your data, but is there a problem in one of your server side scripts with something called "input"?

          • 2. Re: Error trying to consume a ASP.NET Web Service
            emiliovick Level 1

            Thanks for the Quick Response, its Strange because I have a Web Service Located here and on the output Doesn't include Nothing with the tag <input></input>


            The First image of the error are from Internet Explorer, This one came from Mozilla Firefox and are a little different


            Location of The Web Service




            And this is the code in The Web Service


            Public Function GetTitleData() As TitleInfo()


                        'create dataset
                        Dim dsTitleData As New DataSet


                        'create connection
                        Dim objCon As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("dsn").ConnectionString)
                        'create data adapter
                        Dim cmdSQL As SqlDataAdapter = New SqlDataAdapter("SELECT emp_num, store_id, voucher_id FROM voucher", objCon)
                        'fill dataset using data adapter
                        cmdSQL.Fill(dsTitleData, "emp_num")


                        'create object array, using row count as upper dim
                        Dim objTitles As TitleInfo() = New TitleInfo(dsTitleData.Tables(0).Rows.Count - 1) {}


                        'loop through dataset to add data to object array
                        Dim intRsCount As Int16
                        For intRsCount = 0 To dsTitleData.Tables(0).Rows.Count - 1
                            objTitles(intRsCount) = New TitleInfo
                            objTitles(intRsCount).strTitleName = dsTitleData.Tables(0).Rows(intRsCount)("emp_num")
                            objTitles(intRsCount).strstore_id = dsTitleData.Tables(0).Rows(intRsCount)("store_id")
                            objTitles(intRsCount).strvoucher_id = dsTitleData.Tables(0).Rows(intRsCount)("voucher_id")


                        'return object array
                        Return objTitles


                    Catch exp As Exception
                    End Try


                End Function




            Thanks for the help