locked
Uploading Dataset to WebService RRS feed

  • Question

  • I've got a webservice that takes in a custom DataSet.   I've got a client that builds the dataset, utlizing the webservice's dataset classes, then calles the method to pass the dataset to the service.   However, the data is getting lost in the transmission, and I'm not sure where to look to find the error.  When the dataset leaves, there are 5 records in the dataset.  When the webservice starts to act on the parameters, there are 0 records in the dataset.  Where did they go?

    WebService Code:
    [WebMethod]  
        public bool SubmitTrackLog(MyDataSet.FixesDataTable dsFixes)  
        {  
            MyDataSetTableAdapters.FixesTableAdapter db = new MyDataSetTableAdapters.FixesTableAdapter();  
            int count = dsFixes.Count;  // this is always 0?!?!?!?
     
            foreach (MyDataSet.FixesRow f in dsFixes)  
            {  
                db.Insert(f.Lat, f.Lon, f.Track, f.Speed, f.Alt, f.TimeStamp);  
            }  
            return true;  
        } 
     
    Client Code:
    MyWebService.MyDataSet ds = new MyWebService.MyDataSet();  
    int iTmp = 0;  
    foreach (Fixes f in results)  
    {  
         MyWebService.MyDataSet.FixesRow row = ds.Fixes.NewFixesRow();  
         row.FixID = f.FixId;  
         row.Lat = f.Lat.Value;  
         row.Lon = f.Lon.Value;  
         row.Track = f.Track.Value;  
         row.Speed = f.Speed.Value;  
         row.Alt = f.Alt.Value;  
         row.TimeStamp = f.TimeStamp.Value;  
         ds.Fixes.AddFixesRow(row);  
    }  
     
    // create web service reference  
    MyWebService.MyTrackerSoapClient web = new MyWebService.MyTrackerSoapClient();  
     
    // send data  
    web.SubmitTrackLog(ds.Fixes);  // ds.Fixes contains 5 rows...  
     

    Any suggestions/comments would be appreciated.
    Thanks,
    -Glenn
    Wednesday, July 16, 2008 3:24 PM

Answers

  • fhhowdy said:

    I've got a webservice that takes in a custom DataSet.   I've got a client that builds the dataset, utlizing the webservice's dataset classes, then calles the method to pass the dataset to the service.   However, the data is getting lost in the transmission, and I'm not sure where to look to find the error.  When the dataset leaves, there are 5 records in the dataset.  When the webservice starts to act on the parameters, there are 0 records in the dataset.  Where did they go?

    WebService Code:

    [WebMethod]  
        public bool SubmitTrackLog(MyDataSet.FixesDataTable dsFixes)  
        {  
            MyDataSetTableAdapters.FixesTableAdapter db = new MyDataSetTableAdapters.FixesTableAdapter();  
            int count = dsFixes.Count;  // this is always 0?!?!?!?
     
            foreach (MyDataSet.FixesRow f in dsFixes)  
            {  
                db.Insert(f.Lat, f.Lon, f.Track, f.Speed, f.Alt, f.TimeStamp);  
            }  
            return true;  
        } 
     
    Client Code:
    MyWebService.MyDataSet ds = new MyWebService.MyDataSet();  
    int iTmp = 0;  
    foreach (Fixes f in results)  
    {  
         MyWebService.MyDataSet.FixesRow row = ds.Fixes.NewFixesRow();  
         row.FixID = f.FixId;  
         row.Lat = f.Lat.Value;  
         row.Lon = f.Lon.Value;  
         row.Track = f.Track.Value;  
         row.Speed = f.Speed.Value;  
         row.Alt = f.Alt.Value;  
         row.TimeStamp = f.TimeStamp.Value;  
         ds.Fixes.AddFixesRow(row);  
    }  
     
    // create web service reference  
    MyWebService.MyTrackerSoapClient web = new MyWebService.MyTrackerSoapClient();  
     
    // send data  
    web.SubmitTrackLog(ds.Fixes);  // ds.Fixes contains 5 rows...  
     

    Any suggestions/comments would be appreciated.
    Thanks,
    -Glenn



    You say: 
    int count = dsFixes.Count;  // this is always 0?!?!?!?

    Of course there are 0 records. You hadn't added them yet. You add them in the foreach loop that follows.
    Also, I see form your code (web.SubmitTrackLog(ds.Fixes);  // ds.Fixes contains 5 rows...) that to the client arrive 5 records (the ones added in the foreach loop that you spoke about before). So I don't see where is the problem.

    Lucian Baciu, MCTS, http://studentclub.ro/lucians_weblog
    Wednesday, August 20, 2008 8:35 AM
    Moderator

All replies

  • Hi, is this still a problem for you?
    John Saunders | Use File->New Project to create Web Service Projects
    Tuesday, August 5, 2008 11:40 AM
    Moderator
  • fhhowdy said:

    I've got a webservice that takes in a custom DataSet.   I've got a client that builds the dataset, utlizing the webservice's dataset classes, then calles the method to pass the dataset to the service.   However, the data is getting lost in the transmission, and I'm not sure where to look to find the error.  When the dataset leaves, there are 5 records in the dataset.  When the webservice starts to act on the parameters, there are 0 records in the dataset.  Where did they go?

    WebService Code:

    [WebMethod]  
        public bool SubmitTrackLog(MyDataSet.FixesDataTable dsFixes)  
        {  
            MyDataSetTableAdapters.FixesTableAdapter db = new MyDataSetTableAdapters.FixesTableAdapter();  
            int count = dsFixes.Count;  // this is always 0?!?!?!?
     
            foreach (MyDataSet.FixesRow f in dsFixes)  
            {  
                db.Insert(f.Lat, f.Lon, f.Track, f.Speed, f.Alt, f.TimeStamp);  
            }  
            return true;  
        } 
     
    Client Code:
    MyWebService.MyDataSet ds = new MyWebService.MyDataSet();  
    int iTmp = 0;  
    foreach (Fixes f in results)  
    {  
         MyWebService.MyDataSet.FixesRow row = ds.Fixes.NewFixesRow();  
         row.FixID = f.FixId;  
         row.Lat = f.Lat.Value;  
         row.Lon = f.Lon.Value;  
         row.Track = f.Track.Value;  
         row.Speed = f.Speed.Value;  
         row.Alt = f.Alt.Value;  
         row.TimeStamp = f.TimeStamp.Value;  
         ds.Fixes.AddFixesRow(row);  
    }  
     
    // create web service reference  
    MyWebService.MyTrackerSoapClient web = new MyWebService.MyTrackerSoapClient();  
     
    // send data  
    web.SubmitTrackLog(ds.Fixes);  // ds.Fixes contains 5 rows...  
     

    Any suggestions/comments would be appreciated.
    Thanks,
    -Glenn



    You say: 
    int count = dsFixes.Count;  // this is always 0?!?!?!?

    Of course there are 0 records. You hadn't added them yet. You add them in the foreach loop that follows.
    Also, I see form your code (web.SubmitTrackLog(ds.Fixes);  // ds.Fixes contains 5 rows...) that to the client arrive 5 records (the ones added in the foreach loop that you spoke about before). So I don't see where is the problem.

    Lucian Baciu, MCTS, http://studentclub.ro/lucians_weblog
    Wednesday, August 20, 2008 8:35 AM
    Moderator