473,793 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using web service

Hi

I need to be able to call a web service method, receive the dataset that web
method returns and store it in an access table. My problem is that I don't
know how to "receive" a complex type like a dataset and how to link it to
the access table that it is supposed to go in. Could someone please give me
a code example?

Thanks

Regards
Nov 20 '05 #1
8 1588
Hi John,

A complete sample it gets an image from disk puts that in an dataset, gives
it to a webserver where it is saved as a dataset, readed again and it uses
as transport a dataset using webservice.
(With the buttons on the form)

It is not ready yet there are no comment lines for that you have to wait
something longer,

However I hope this helps?

Cor

\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////
Nov 20 '05 #2
Hi,

HYPERLINK
"http://www.onteorasoft ware.com/downloads/DibertWebServic eExample.zip"ht tp://www.onteorasoft ware.com/downloads/DibertWebServic eExample.zip

Ken

------------------------------------

From: John [mailto:jo**@nos pam.infovis.co. uk]
Sent: Tuesday, June 22, 2004 1:48 PM
To: microsoft.publi c.dotnet.langua ges.vb
Subject: Using web service

Hi

I need to be able to call a web service method, receive the dataset that
web
method returns and store it in an access table. My problem is that I
don't
know how to "receive" a complex type like a dataset and how to link it
to
the access table that it is supposed to go in. Could someone please give
me
a code example?

Thanks

Regards
--
Incoming mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004
Nov 20 '05 #3
Thanks for this. I start reading a remote dataset in bytes wouldn't it be
too slow? Isn't there a way to read at least a record at a time? Otherwise,
can I receive and save the whole dataset locally as xml file, on which I can
open a local dataset?

Thanks

Regards

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uQ******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

HYPERLINK
"http://www.onteorasoft ware.com/downloads/DibertWebServic eExample.zip"ht tp:/
/www.onteorasoft ware.com/downloads/DibertWebServic eExample.zip
Ken

------------------------------------

From: John [mailto:jo**@nos pam.infovis.co. uk]
Sent: Tuesday, June 22, 2004 1:48 PM
To: microsoft.publi c.dotnet.langua ges.vb
Subject: Using web service

Hi

I need to be able to call a web service method, receive the dataset that
web
method returns and store it in an access table. My problem is that I
don't
know how to "receive" a complex type like a dataset and how to link it
to
the access table that it is supposed to go in. Could someone please give
me
a code example?

Thanks

Regards
--
Incoming mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.3 - Release Date: 6/18/2004

Nov 20 '05 #4
Hi John,

I am curious why you ignore my complete working sample of an XML dataset
with a webservice which does almost exactly as you describe (except the
simple action to place it in an access database)?

Cor
Nov 20 '05 #5
Hi Cor

Thanks for that.

Where does ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) store the
xml file? On the pc calling the web service or the server where web service
residues?

My application is slightly different in that I want the remote dataset to
end up in a local access table. For an image image.fromstrea m makes it easy
but is there an easy way to get the remote dataset into an access table too?

Thanks

Regards

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OE******** ******@TK2MSFTN GP12.phx.gbl...
Hi John,

A complete sample it gets an image from disk puts that in an dataset, gives it to a webserver where it is saved as a dataset, readed again and it uses
as transport a dataset using webservice.
(With the buttons on the form)

It is not ready yet there are no comment lines for that you have to wait
something longer,

However I hope this helps?

Cor

\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////

Nov 20 '05 #6
Hi John,

You can just move it into the dataset of the acces file, or when the dataset
is equal to the access table you can even insert it. I do not believe in
that because when you than does that twice you have a constraint error. I
think it is better just to get the item from the dataset and set that in the
with the key readed access datatable and than update that.

Than you can update when it exist and insert it when it is new using the
normal dataadapter technique.

However where comes your data from, than I can maybe make a sample what
looks something more like that.

However I am writing this while you no that there is EK, so I review this
tomorrow when this is a problem. Message that than.

In my opinion it is even easier to put it in an Access file than writting it
to disk.

A pity you did not answer earlier, I am busy tomorrow when I have time I
will try to give you an example of that tomorrow but that will than not
early

(When you do not need that message that than)

Cor

Thanks for that.

Where does ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) store the xml file? On the pc calling the web service or the server where web service residues?

My application is slightly different in that I want the remote dataset to
end up in a local access table. For an image image.fromstrea m makes it easy but is there an easy way to get the remote dataset into an access table too?
Thanks

Regards

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OE******** ******@TK2MSFTN GP12.phx.gbl...
Hi John,

A complete sample it gets an image from disk puts that in an dataset,

gives
it to a webserver where it is saved as a dataset, readed again and it uses as transport a dataset using webservice.
(With the buttons on the form)

It is not ready yet there are no comment lines for that you have to wait
something longer,

However I hope this helps?

Cor

\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////


Nov 20 '05 #7
Hi John,

As told above simple (I have made the access database in this sample, that
is the major part, while I as well have used the dataset which comes direct
from the Access database to keep the sample simple)

I hope this helps?

Cor

\\\
'Needs a form with 2 buttons
'set a reference to ado ext 2.7 for blabla
Private conn As New
OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;" & _
"Data Source=C:\db1.m db;User Id=admin;Passwo rd=;")
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Dim da As New OleDb.OleDbData Adapter("Select * from countries",
conn)
Dim ds As New DataSet
da.Fill(ds)
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow())
ds.Tables(0).Ro ws(0)(1) = 1
ds.Tables(0).Ro ws(0)(2) = "Holland"
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(d s)
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
Dim da As New OleDb.OleDbData Adapter("Select * from countries",
conn)
Dim ds As New DataSet
Dim cmd As New OleDb.OleDbComm andBuilder(da)
Dim ws As New localhost.DataB aseUpdate
ds = ws.GetDataset()
da.Update(ds)
End Sub
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c: \db1.mdb")
If fi.Exists Then
If MessageBox.Show ("Delete?", "Existing File db1.mdb", _
MessageBoxButto ns.YesNo) = DialogResult.Ye s Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create ("Provider=Micr osoft.Jet.OLEDB .4.0;" & "Data
Source=C:\db1.m db")
Dim cmd As New OleDb.OleDbComm and("CREATE TABLE countries ( " & _
"AutoId int identity ," & _
"Id int NOT NULL," & _
"Name NVarchar(50)," & _
"CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn)
conn.Open()
cmd.ExecuteNonQ uery()
conn.Close()
End Sub
///
\\\
<WebMethod()> _
Public Function GetDataset() As DataSet
Dim ds As New DataSet
ds.ReadXml("C:\ wsTest.xml")
Return ds
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l ds As DataSet)
ds.WriteXml("C: \wsTest.xml", XmlWriteMode.Wr iteSchema)
End Sub
///

,

You can just move it into the dataset of the acces file, or when the dataset is equal to the access table you can even insert it. I do not believe in
that because when you than does that twice you have a constraint error. I
think it is better just to get the item from the dataset and set that in the with the key readed access datatable and than update that.

Than you can update when it exist and insert it when it is new using the
normal dataadapter technique.

However where comes your data from, than I can maybe make a sample what
looks something more like that.

However I am writing this while you no that there is EK, so I review this
tomorrow when this is a problem. Message that than.

In my opinion it is even easier to put it in an Access file than writting it to disk.

A pity you did not answer earlier, I am busy tomorrow when I have time I
will try to give you an example of that tomorrow but that will than not
early

(When you do not need that message that than)

Cor

Thanks for that.

Where does ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) store

the
xml file? On the pc calling the web service or the server where web

service
residues?

My application is slightly different in that I want the remote dataset to
end up in a local access table. For an image image.fromstrea m makes it

easy
but is there an easy way to get the remote dataset into an access table

too?

Thanks

Regards

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OE******** ******@TK2MSFTN GP12.phx.gbl...
Hi John,

A complete sample it gets an image from disk puts that in an dataset,

gives
it to a webserver where it is saved as a dataset, readed again and it

uses as transport a dataset using webservice.
(With the buttons on the form)

It is not ready yet there are no comment lines for that you have to wait something longer,

However I hope this helps?

Cor

\\\needs a picturebox and 4 buttons on a windowform
Dim ds As New DataSet
Private abyt() As Byte
Private fo As New OpenFileDialog
Private sf As New SaveFileDialog
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Reading a picture from disk and put it in a bytearray
If fo.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(f o.FileName, _
IO.FileMode.Ope n)
Dim br As New IO.BinaryReader (fs)
abyt = br.ReadBytes(CI nt(fs.Length))
br.Close()
'just to show the sample without a fileread error
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End If
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
'writing a picture from a bytearray to disk
If sf.ShowDialog = DialogResult.OK Then
Dim fs As New IO.FileStream(s f.FileName, _
IO.FileMode.Cre ateNew)
Dim bw As New IO.BinaryWriter (fs)
bw.Write(abyt)
bw.Close()
End If
End Sub
Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button3.Click
'writing a bytearray to a webservice dataset
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(a byt)
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'reading a picture from a webservice dataset
Dim ws As New localhost.DataB aseUpdate
abyt = ws.GetByte
Dim ms As New IO.MemoryStream (abyt)
Me.PictureBox1. Image = Image.FromStrea m(ms)
End Sub
End Class
////
\\\\Webservice
<WebMethod()> _
Public Function GetByte() As Byte()
Dim ds As New DataSet
ds.ReadXml("C:\ wsblob.xml")
Return CType(ds.Tables (0).Rows(0)(0), Byte())
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l abyte As Byte())
Dim ds As New DataSet
ds.Tables.Add(N ew DataTable("Phot o"))
ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
ds.Tables(0).Ro ws(0)(0) = abyte
ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
End Sub
////



Nov 20 '05 #8
Hi Cor

That's excellent! Thanks for this. Works fine for me.

Regards

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Hi John,

As told above simple (I have made the access database in this sample, that
is the major part, while I as well have used the dataset which comes direct from the Access database to keep the sample simple)

I hope this helps?

Cor

\\\
'Needs a form with 2 buttons
'set a reference to ado ext 2.7 for blabla
Private conn As New
OleDb.OleDbConn ection("Provide r=Microsoft.Jet .OLEDB.4.0;" & _
"Data Source=C:\db1.m db;User Id=admin;Passwo rd=;")
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
Dim da As New OleDb.OleDbData Adapter("Select * from countries",
conn)
Dim ds As New DataSet
da.Fill(ds)
ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow())
ds.Tables(0).Ro ws(0)(1) = 1
ds.Tables(0).Ro ws(0)(2) = "Holland"
Dim ws As New localhost.DataB aseUpdate
ws.SetDataset(d s)
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
e As System.EventArg s) Handles Button2.Click
Dim da As New OleDb.OleDbData Adapter("Select * from countries",
conn)
Dim ds As New DataSet
Dim cmd As New OleDb.OleDbComm andBuilder(da)
Dim ws As New localhost.DataB aseUpdate
ds = ws.GetDataset()
da.Update(ds)
End Sub
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim catNewDB As New ADOX.Catalog
Dim fi As New IO.FileInfo("c: \db1.mdb")
If fi.Exists Then
If MessageBox.Show ("Delete?", "Existing File db1.mdb", _
MessageBoxButto ns.YesNo) = DialogResult.Ye s Then
fi.Delete()
Else
Exit Sub
End If
End If
catNewDB.Create ("Provider=Micr osoft.Jet.OLEDB .4.0;" & "Data
Source=C:\db1.m db")
Dim cmd As New OleDb.OleDbComm and("CREATE TABLE countries ( " & _
"AutoId int identity ," & _
"Id int NOT NULL," & _
"Name NVarchar(50)," & _
"CONSTRAINT [pk_AutoId] PRIMARY KEY (AutoId)) ", conn) conn.Open()
cmd.ExecuteNonQ uery()
conn.Close()
End Sub
///
\\\
<WebMethod()> _
Public Function GetDataset() As DataSet
Dim ds As New DataSet
ds.ReadXml("C:\ wsTest.xml")
Return ds
End Function
<WebMethod()> _
Public Sub SetDataset(ByVa l ds As DataSet)
ds.WriteXml("C: \wsTest.xml", XmlWriteMode.Wr iteSchema)
End Sub
///

,

You can just move it into the dataset of the acces file, or when the dataset
is equal to the access table you can even insert it. I do not believe in
that because when you than does that twice you have a constraint error. I
think it is better just to get the item from the dataset and set that in

the
with the key readed access datatable and than update that.

Than you can update when it exist and insert it when it is new using the
normal dataadapter technique.

However where comes your data from, than I can maybe make a sample what
looks something more like that.

However I am writing this while you no that there is EK, so I review this tomorrow when this is a problem. Message that than.

In my opinion it is even easier to put it in an Access file than writting it
to disk.

A pity you did not answer earlier, I am busy tomorrow when I have time I
will try to give you an example of that tomorrow but that will than not
early

(When you do not need that message that than)

Cor

Thanks for that.

Where does ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema) store the
xml file? On the pc calling the web service or the server where web

service
residues?

My application is slightly different in that I want the remote dataset to end up in a local access table. For an image image.fromstrea m makes it

easy
but is there an easy way to get the remote dataset into an access
table too?

Thanks

Regards

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OE******** ******@TK2MSFTN GP12.phx.gbl...
> Hi John,
>
> A complete sample it gets an image from disk puts that in an
dataset, gives
> it to a webserver where it is saved as a dataset, readed again and

it uses
> as transport a dataset using webservice.
> (With the buttons on the form)
>
> It is not ready yet there are no comment lines for that you have to

wait > something longer,
>
> However I hope this helps?
>
> Cor
>
> \\\needs a picturebox and 4 buttons on a windowform
> Dim ds As New DataSet
> Private abyt() As Byte
> Private fo As New OpenFileDialog
> Private sf As New SaveFileDialog
> Private Sub Button1_Click(B yVal sender As System.Object, _
> ByVal e As System.EventArg s) Handles Button1.Click
> 'Reading a picture from disk and put it in a bytearray
> If fo.ShowDialog = DialogResult.OK Then
> Dim fs As New IO.FileStream(f o.FileName, _
> IO.FileMode.Ope n)
> Dim br As New IO.BinaryReader (fs)
> abyt = br.ReadBytes(CI nt(fs.Length))
> br.Close()
> 'just to show the sample without a fileread error
> Dim ms As New IO.MemoryStream (abyt)
> Me.PictureBox1. Image = Image.FromStrea m(ms)
> End If
> End Sub
> Private Sub Button2_Click(B yVal sender As System.Object, ByVal _
> e As System.EventArg s) Handles Button2.Click
> 'writing a picture from a bytearray to disk
> If sf.ShowDialog = DialogResult.OK Then
> Dim fs As New IO.FileStream(s f.FileName, _
> IO.FileMode.Cre ateNew)
> Dim bw As New IO.BinaryWriter (fs)
> bw.Write(abyt)
> bw.Close()
> End If
> End Sub
> Private Sub Button3_Click(B yVal sender As System.Object, ByVal _
> e As System.EventArg s) Handles Button3.Click
> 'writing a bytearray to a webservice dataset
> Dim ws As New localhost.DataB aseUpdate
> ws.SetDataset(a byt)
> End Sub
> Private Sub Button4_Click(B yVal sender As System.Object, _
> ByVal e As System.EventArg s) Handles Button4.Click
> 'reading a picture from a webservice dataset
> Dim ws As New localhost.DataB aseUpdate
> abyt = ws.GetByte
> Dim ms As New IO.MemoryStream (abyt)
> Me.PictureBox1. Image = Image.FromStrea m(ms)
> End Sub
> End Class
> ////
> \\\\Webservice
> <WebMethod()> _
> Public Function GetByte() As Byte()
> Dim ds As New DataSet
> ds.ReadXml("C:\ wsblob.xml")
> Return CType(ds.Tables (0).Rows(0)(0), Byte())
> End Function
> <WebMethod()> _
> Public Sub SetDataset(ByVa l abyte As Byte())
> Dim ds As New DataSet
> ds.Tables.Add(N ew DataTable("Phot o"))
> ds.Tables(0).Co lumns.Add(New DataColumn("Sam ple"))
> ds.Tables(0).Co lumns(0).DataTy pe = GetType(System. Byte())
> ds.Tables(0).Ro ws.Add(ds.Table s(0).NewRow)
> ds.Tables(0).Ro ws(0)(0) = abyte
> ds.WriteXml("C: \wsblob.xml", XmlWriteMode.Wr iteSchema)
> End Sub
> ////
>
>



Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
8375
by: grutta | last post by:
I am writing a windows service that will recieve notification when a USB Device is insterted into the machine. I have used the RegisterDeviceNotification and the RegisterServiceCtrlHandlerEx with a handler. The handler portion seems to fail indicating that my parameters are invalid. I am getting an error code 126 when i try to register the handler and 28 when i register for event notification. Any ideas as to what the deal is? I am...
2
3294
by: raghavendra | last post by:
Hi, How to run automatically windows service by using setup deployment insatllation script using visual studio 2003.? What i did is :-- 1. created a windows service & tested the same. 2. then i used the windowsservice.exe in setup deployment project.
6
2181
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found Line: 0 - Metadata file 'RemoteLoader.dll' could not be found Line: 0 - Metadata file 'wwScripting.dll' could not be found' Service ran all night fine. This morning I reconnected to the process and the errors are no longer there. Only thing...
14
5804
by: pmud | last post by:
Hi, I need to use an Excel Sheet in ASP.NET application so that the users can enter (copy, paste ) large number of rows in this Excel Sheet. Also, Whatever the USER ENETRS needs to go to the SQL DATABASE, probably by the click of a button. Is this possible? & what is the BEST APPROACH for doing this? & also if any links are there do tell those to me too coz I have no idea how to go about doing it.
5
1666
by: Derek Martin | last post by:
I am creating a windows service and have added a reference to a DLL project that I have created. That DLL file is correctly referenced in both a windows app and a web app, all in the same solution, so I thought I could do the same for a service project. However, after successfully adding the reference and making sure the namespaces were correct, I cannot see any of my public methods and functions from the DLL file. Is there anything...
3
5084
by: Michael Hoehne | last post by:
Hi, I'm currently facing a problem with a mixed environment using .NET 1.1 and ..NET 2.0 web services. We have a client application (the "client", system 1) running on .NET 2.0/WinXP, calling our web service (The "Web Service Server") running on a separate machine (also .NET 2.0, Win2003 Server, system 2). The web service server (system 2) itself makes calls to methods in the CRM
1
3327
by: Sandy | last post by:
I am defining a web service to receive data that represents an application form and that returns a message indicating if the application form has been successfully validated or not, listing any errors. I would like to use XPath to define the validation rules that will be executed within the web service. Clearly, to do this my data has to be in XML format. However, I would like my WSDL to describe explicitly the schema of the
3
13806
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web service run in an application pool which runs under a domain user, this domain user has permissions of accessing database and the connection to database is trusted connection. All these work well. The web application will be used in internet (not...
0
2682
by: =?Utf-8?B?TWFuaQ==?= | last post by:
Hi All, Problem in deploying my WebService developed using Asp.net WebServices 2005. I have designed simple WebService using Asp.net Webservices 2.0 , The webservice look this , using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols;
25
11666
smithj14
by: smithj14 | last post by:
I have a form that has an option group (fraReports) which holds a list of reports to print. This part works fine. I select a report name and click print and that report opens. Now I want to add a text box to enter a service date that will open the selected report using the text box value (service date) to filter the report to only those dates. I have the field using the format "mmmm-yyyy" on all my forms and reports so it will show May-2009....
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10212
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10161
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.