Beispiel #1
0
		private void cmdLoadDataset_Click(object sender, System.EventArgs e)
		{
			// call the service
			localhost.Service1 svc = new localhost.Service1();
			svc.GetDataSet();

			// get the SOAP context, see if there are attachments
			SoapContext sc = svc.ResponseSoapContext;
			if (1 != sc.Attachments.Count)
			{
				MessageBox.Show("Error: # of attachments received is not the # that was expected");
				return;
			}

			GZipInputStream gzipInputStream = new GZipInputStream(sc.Attachments[0].Stream);
			MemoryStream ms = new MemoryStream(1024);
			int nSize = 2048;
			byte[] writeData = new byte[2048];

			while (true) 
			{
				nSize = gzipInputStream.Read(writeData, 0, nSize);
				if (nSize > 0) 
					ms.Write(writeData, 0, nSize);
				else 
					break;
			}
			
			ms.Seek(0, SeekOrigin.Begin);

			DataSet ds = new DataSet();
			ds.ReadXml(ms);
			dg.SetDataBinding(ds, "Customers");
		}
Beispiel #2
0
		private void cmdLoadDataset_Click(object sender, System.EventArgs e)
		{
			// call the service
			localhost.Service1 svc = new localhost.Service1();
			svc.GetDataSet();

			// get the SOAP context, see if there are attachments
			SoapContext sc = svc.ResponseSoapContext;
			if (1 != sc.Attachments.Count)
			{
				MessageBox.Show("Error: # of attachments received is not the # that was expected");
				return;
			}

			GZipInputStream gzipInputStream = new GZipInputStream(sc.Attachments[0].Stream);
			MemoryStream ms = new MemoryStream(1024);
			int nSize = 2048;
			byte[] writeData = new byte[2048];

			while (true) 
			{
				nSize = gzipInputStream.Read(writeData, 0, nSize);
				if (nSize > 0) 
					ms.Write(writeData, 0, nSize);
				else 
					break;
			}
			
			ms.Seek(0, SeekOrigin.Begin);

			DataSet ds = new DataSet();
			ds.ReadXml(ms);
			dg.SetDataBinding(ds, "Customers");
		}