Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 107,708 C# Programmers for FREE! Ask your question and get quick answers from experts. There are 1,101 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



.NET and Web Services

 
Reply to this topicStart new topic

.NET and Web Services, Getting partial XML response with .NET

jvds2001
post 18 Jul, 2008 - 03:32 PM
Post #1


New D.I.C Head

*
Joined: 18 Jul, 2008
Posts: 1

Hi,

I'm using Visual Studio 2005.

Need to expose a report via a SOAP interface, know its a bad idea not my decision. Created a Web Services and a Class representing the required fields. When I run and select a single instance of the selected rows the Service correctly returns the full XML. When I define an array of desired class and populate the array with rows the interface do not return the entire XML, it only appears to return the header or port of the header.

See excerpts below
CODE

   public class activity
    {
        private string datum;
        private string time;
        private string txnType;
        private string voidFlag;

........


        public string Datum
        {   get { return datum; } set { datum = value; }
        }
        public string Time
        {  get { return time; }   set { time = value; }
        }
        public string TxnType
        {   get { return txnType; } set { txnType = value; }
        }

............
public activity()
        {
            //
            // TODO: Add constructor logic here
            //

        }
    }

snippets from web service
CODE

  int i = 0;
            activity[] row =new activity[100];
            ConnectionStringSettings cs =
                ConfigurationManager.ConnectionStrings["OpticardConnectionString"];
            string connString = cs.ConnectionString;
            using (OdbcConnection connection = new OdbcConnection(connString))
            {
                OdbcCommand command = new OdbcCommand(SQL, connection);
                connection.Open();

            // Execute the DataReader and access the data.
                OdbcDataReader reader = command.ExecuteReader();
                int numRows = reader.RecordsAffected;
                
                while (reader.Read())
                {
                    row[i] = new activity();
                    row[i].Datum = reader.IsDBNull(1) ? "" : reader.GetString(1);// (string)reader[1];  // trans_date
                    row[i].Time = reader.IsDBNull(2) ? "" : reader.GetString(2); //(string)reader[2];  // trans_time
                    //activity.TxnType =          (int)reader[3];
  ..............
      
                }
                reader.Close();
             }
             return row[i];

This does not return complete xml! however if I only use a single instance of the class 'activity'
as opposed to the array, I do get a well formed complete XML response!

Any ideas suggestions will be greatly appreciated! TIA!

OKay, I found an error with my code, yikes! i is pointing past the last valid row? If I return row The compiler complains that it can not convert type activity[] to activity?

This post has been edited by jvds2001: 18 Jul, 2008 - 03:54 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/30/08 03:01AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month