DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 9 Jul 2007 17:29:49 +1000,    posted on: microsoft.public.dotnet.framework.aspnet.webservices        back       

Thread Index
  1    Stephen Ahn noaddress


problem sending significant whitespace in DataSets across webservice (dotnet 2.0)   
Using VS2005, dotnet 2.0.
Here's some code which reproduces the issue.

Web Service code :
==
        [WebMethod]
        public string SendDataSet(DataSet ds)
        {
            DataRow dr = ds.Tables[0].Rows[0];

   string sCurrent = (string)dr[0, DataRowVersion.Current];
   string sOriginal = (string)dr[0, DataRowVersion.Original];

            return "current : " + GetStringAsHex(sCurrent) + ", original : " 
+ GetStringAsHex(sOriginal);

        }

        private static string GetStringAsHex(string str)
        {
            System.Text.StringBuilder sb = new 
System.Text.StringBuilder("0x");
            for (int i = 0; i < str.Length; i++)
            {
                sb.AppendFormat("{0:X2}", (int)str[i]);
            }

            return sb.ToString();
        }
==

Run this code on the client end :
==
        private void bDataSetTest_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();
            DataTable dt = ds.Tables.Add("t");
            dt.Columns.Add("Data", typeof(string));

            DataRow dr = dt.NewRow();
            dr["Data"] = "\n";
            dt.Rows.Add(dr);
            dt.AcceptChanges();
            dr["Data"] = "\n";


            HelloWorldWebServiceTestApp.localhost.HelloWorldWebService ws = 
new HelloWorldWebServiceTestApp.localhost.HelloWorldWebService();
            ws.Url = this.tbUrl.Text.Trim();

            string res = ws.SendDataSet(ds);
            MessageBox.Show(res);
        }
==

The messagebox displays :  "current : 0x0A, original : 0x".
I was expecting : "current : 0x0A, original : 0x0A".

So, there seems to be a problem with the original value of columns which 
only contain whitespace. The web method does not see exactly what the client 
has sent.

Any ideas ?
Thanks,
Stephen
Date:Mon, 9 Jul 2007 17:29:49 +1000   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us