WSDL Query returns sets of blank records.

Discussion created by RobertG on Oct 12, 2010
Latest reply on Oct 12, 2010 by Chris_Hackett
Hello all.   It's my plan using Visual Studio to write a windows service to pull certain information from Clarity for later analysis.   Using various examples on this website and others,   I've put together the following test routine on a windows form as a test-of-concept:=
messages.Clear();  //this is a richtextbox object.


            // NOTE: Clarity.Projmgttest.Query maps to URL http://nikutest/niku/wsdl/Query/demand%20for%20resource

      Clarity.Projmgttest.Query.demandforresourceQueryService qs;
      qs = new Clarity.Projmgttest.Query.demandforresourceQueryService();

      Clarity.Projmgttest.Query.Login log = new Clarity.Projmgttest.Query.Login();
      Clarity.Projmgttest.Query.Auth auth = new Clarity.Projmgttest.Query.Auth();

      string sessionid = string.Empty;

      log.Username = username.Text;
      log.Password = password.Text;

      sessionid = qs.Login(log);
      auth.SessionID = sessionid;
      qs.AuthValue = auth;
      messages.AppendText("Session ID: " + sessionid + Environment.NewLine + Environment.NewLine);

      if (sessionid != null) //At this point, there is a valid session id.

           messages.AppendText("Logged On ... " + Environment.NewLine);


           Clarity.Projmgttest.Query.demandforresourceQuery qstring = new Clarity.Projmgttest.Query.demandforresourceQuery();
           Clarity.Projmgttest.Query.demandforresourceQueryResult qstringresult;
           Clarity.Projmgttest.Query.demandforresourceFilter qfilter = new Clarity.Projmgttest.Query.demandforresourceFilter();
           Clarity.Projmgttest.Query.demandforresourceRecord rec;

           qstring.Code = "Demand for Resource";

           qfilter.resource_name = "someusername";
           qstring.Filter = qfilter;
           qstringresult = qs.Query(qstring);  //336 records returned.  All values set to 0 or null.

                      rec = qstringresult.Records[0]; // The fields of the first record of the query result are loaded 
                                                              // with zeros or nulls.

                   for (int i = 0; i < qstringresult.Records.Length; i++)  //because all records are blank, nothing prints to the messages box.

                 if (qstringresult.Records.proj_name != null)
messages.AppendText(qstringresult.Records[i].proj_name + " " +

qstringresult.Records[i].proj_name.ToString()+ " " +



messages.AppendText("Logged Off ... " + Environment.NewLine);
messages.AppendText("Session did NOT connect ... " + Environment.NewLine);

Problem:   The fields of all returned records are set to zero or null.    Some Notes:   1.   This routine DOES establish a session.  2.   Changing the value of qfilter.resource_name to different user names DOES change the number of records returned.   Likewise, using a fictitious user name returns zero records.  3.   The qstring.Code value is set to the correct value.   Altering the value to a fictitious query name results in qstringresult being set to null.  4.   Using a single, bona-fide resource name, I'll consistently see a return of 336 records.   I can assign the rec variable the first record returned and see this assignment in the debugger.  5.   I'm assuming I have the correct access to this query because I can access and run the query.  6.   We're using Clarity version 7.5.3.    Question:   Why are all fields in the 336 returned records set to either a zero or null value?        Thanks much...- Robert ...     Message Edited by RobertG on 12-03-2009 03:38 PM [left]