1 Reply Latest reply on Mar 9, 2007 12:29 PM by dennismr

    Can't load .Net DataSet

    curtkauf Level 1
      I'm a real newbee! I'm trying to get back a simple customers DataSet based on two parameters. My mxml code is as follows:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">
      <mx:WebService id="wsCustomers"
      wsdl=" http://localhost/TemperatureWebService/Convert.asmx?wsdl"
      useProxy="false">
      <mx:operation name="GetCustomers">
      <mx:request>
      <user_id>{txtUser_ID.text}</user_id>
      <isacontactfor_lg>{txtDefault_Contact.text}</isacontactfor_lg>
      </mx:request>
      </mx:operation>
      </mx:WebService>
      <mx:TextInput x="34" y="25" width="105" id="txtUser_ID" fontFamily="Arial"/>
      <mx:TextInput x="34" y="55" width="105" id="txtDefault_Contact" fontFamily="Arial"/>
      <mx:DataGrid x="34" y="86" width="427" id="dgCustomers" dataProvider="{wsCustomers.GetCustomers}">
      <mx:columns>
      <mx:DataGridColumn headerText="Entity ID" dataField="Entity_ID"/>
      <mx:DataGridColumn headerText="ER ID" dataField="ER_ID"/>
      <mx:DataGridColumn headerText="ER Type" dataField="ER_Type_ID"/>
      <mx:DataGridColumn headerText="Name" dataField="Name_VC"/>
      </mx:columns>
      </mx:DataGrid>
      <mx:Button x="147" y="55" label="Get Customers" width="133" id="btnCustomers" click="wsCustomers.GetCustomers.send()"/>

      </mx:Application>

      First there appears to be something wrong with the WebService component. It doesn't show the "GetCustomers" operation in the dropdown as I code.

      Second.... here is my .Net WebService code:

      using System;
      using System.Collections.Generic;
      using System.Web;
      using System.Collections;
      using System.Web.Services;
      using System.Data;
      using System.Data.SqlClient;
      using System.Web.Services.Protocols;
      using System.Diagnostics;


      /// <summary>
      /// Summary description for Convert
      /// </summary>
      [WebService(Namespace = " http://tempuri.org/")
      [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
      public class Convert : System.Web.Services.WebService {

      public Convert () {

      //Uncomment the following line if using designed components
      //InitializeComponent();
      }

      [System.Web.Services.WebMethod()]
      public DataSet GetCustomers(string user_id, bool isacontactfor_lg)
      {
      System.Convert.ToInt32(user_id.ToString());
      System.Convert.ToBoolean(isacontactfor_lg.ToString());

      string cn = "Data Source=CPU175;Initial Catalog=devTime21;Integrated Security=True";
      System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(cn);
      SqlCommand cmd = new SqlCommand("MTM_Customers_4A_User_S", sqlConnection);
      cmd.CommandType = CommandType.StoredProcedure;
      cmd.Parameters.AddWithValue("@User_ID", user_id);
      cmd.Parameters.AddWithValue("@IsAContactFor_LG", isacontactfor_lg);


      SqlDataAdapter da = new SqlDataAdapter(cmd);

      System.Data.DataSet dataSet = new System.Data.DataSet();
      da.Fill(dataSet);
      return dataSet;
      }

      The web service functions fine on its own. However when running through the flex debugger I get the following error:

      [WSDLError faultString="Element http://tempuri.org/:GetCustomersResponse not resolvable" faultCode="WSDL.BadElement" faultDetail="null"]

      Can any one help this newbee? I would greatly appreciate any assistance. Thanks so much!!!!

      curtkauf