How do I pass a dataset to a webservices? I need to submit a shoppingcart
from a pocket PC to a webservice.
What is the right datatype?
II have tried dataset as a datatype, but I can't get it to compile.
<WebMethod()> _
Public Function VerifySku(ByVal skus As XmlDataDocument ) As DataSet
Test program :
Dim cartSet As DataSet
cartSet = ws.VerifySku(ca rtSet)
Error:
C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of type
'System.Data.Da taSet' cannot be converted to '1-dimensional array of
System.Object'. 22 25589
You are probably better off using the DataSet's GetXML and ReadXML methods.
In other words, the web service returns the xml from a DataSet as a string.
This xml can then be very easily put back into a new DataSet.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message
news:E1******** *************** ***********@mic rosoft.com... How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument ) As DataSet
Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(ca rtSet)
Error: C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of type 'System.Data.Da taSet' cannot be converted to '1-dimensional array of System.Object'.
Scott,
That is the right answer to the wrong question. I you you read my question
you will find that I have a problem passing a dataset to a web services. I do
not have a problem returning a dataset from a web services.
Do you want to try again to get the right answer?
Arne
"Scott M." wrote: You are probably better off using the DataSet's GetXML and ReadXML methods. In other words, the web service returns the xml from a DataSet as a string. This xml can then be very easily put back into a new DataSet.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E1******** *************** ***********@mic rosoft.com... How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to compile. <WebMethod()> _ Public Function VerifySku(ByVal skus As XmlDataDocument ) As DataSet
Test program : Dim cartSet As DataSet cartSet = ws.VerifySku(ca rtSet)
Error: C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of type 'System.Data.Da taSet' cannot be converted to '1-dimensional array of System.Object'.
Arne,
Wow! Thanks for the attitude. Do you want to try again and read my first
post and see that the answer you seek is in there?
Hint: "the DataSet's GetXML and ReadXML methods".
Perhaps you could think about what I wrote and try to see how it might fit
into your situation.
-Scott
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message
news:E7******** *************** ***********@mic rosoft.com... Scott, That is the right answer to the wrong question. I you you read my question you will find that I have a problem passing a dataset to a web services. I do not have a problem returning a dataset from a web services. Do you want to try again to get the right answer? Arne
"Scott M." wrote:
You are probably better off using the DataSet's GetXML and ReadXML methods. In other words, the web service returns the xml from a DataSet as a string. This xml can then be very easily put back into a new DataSet.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E1******** *************** ***********@mic rosoft.com... > How do I pass a dataset to a webservices? I need to submit a > shoppingcart > from a pocket PC to a webservice. > What is the right datatype? > II have tried dataset as a datatype, but I can't get it to compile. > <WebMethod()> _ > Public Function VerifySku(ByVal skus As XmlDataDocument ) As DataSet > > Test program : > Dim cartSet As DataSet > cartSet = ws.VerifySku(ca rtSet) > > Error: > C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of type > 'System.Data.Da taSet' cannot be converted to '1-dimensional array of > System.Object'. > >
Scott,
I reread your two posts, but I am not able to understand your answer. All I
am interested in is a datatype to use when sending a dataset to a web
services. Would that be an
XMLDocument
XMLElement
XMLDataDocument
String
or some other hocus pocus.
Arne.
"Scott M." wrote: Arne,
Wow! Thanks for the attitude. Do you want to try again and read my first post and see that the answer you seek is in there?
Hint: "the DataSet's GetXML and ReadXML methods".
Perhaps you could think about what I wrote and try to see how it might fit into your situation.
-Scott
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E7******** *************** ***********@mic rosoft.com... Scott, That is the right answer to the wrong question. I you you read my question you will find that I have a problem passing a dataset to a web services. I do not have a problem returning a dataset from a web services. Do you want to try again to get the right answer? Arne
"Scott M." wrote:
You are probably better off using the DataSet's GetXML and ReadXML methods. In other words, the web service returns the xml from a DataSet as a string. This xml can then be very easily put back into a new DataSet.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E1******** *************** ***********@mic rosoft.com... > How do I pass a dataset to a webservices? I need to submit a > shoppingcart > from a pocket PC to a webservice. > What is the right datatype? > II have tried dataset as a datatype, but I can't get it to compile. > <WebMethod()> _ > Public Function VerifySku(ByVal skus As XmlDataDocument ) As DataSet > > Test program : > Dim cartSet As DataSet > cartSet = ws.VerifySku(ca rtSet) > > Error: > C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of type > 'System.Data.Da taSet' cannot be converted to '1-dimensional array of > System.Object'. > >
Arne,
If you have data in a DataSet, you have a couple of choices:
1. Just pass the entire DataSet object to a web service web method that
takes a DataSet as a parameter. (I don't recommend this approach if the
DataSet will be passed between 2 machines in the process because of
efficiency).
2. Use the DataSet.GetXML method (which returns an XML string representing
the DataSet) and pass that string to a web service web method. Then that
web method would declare a new DataSet and using the ReadXML method, it
could read the XML string into itself. You will need to load the XML string
into an XMLDocument and then pass it to an XMLNodeReader so that it can be
read into the DataSet using ReadXML.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message
news:9E******** *************** ***********@mic rosoft.com... Scott, I reread your two posts, but I am not able to understand your answer. All I am interested in is a datatype to use when sending a dataset to a web services. Would that be an XMLDocument XMLElement XMLDataDocument String or some other hocus pocus. Arne.
"Scott M." wrote:
Arne,
Wow! Thanks for the attitude. Do you want to try again and read my first post and see that the answer you seek is in there?
Hint: "the DataSet's GetXML and ReadXML methods".
Perhaps you could think about what I wrote and try to see how it might fit into your situation.
-Scott
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E7******** *************** ***********@mic rosoft.com... > Scott, > That is the right answer to the wrong question. I you you read my > question > you will find that I have a problem passing a dataset to a web > services. I > do > not have a problem returning a dataset from a web services. > Do you want to try again to get the right answer? > Arne > > "Scott M." wrote: > >> You are probably better off using the DataSet's GetXML and ReadXML >> methods. >> In other words, the web service returns the xml from a DataSet as a >> string. >> This xml can then be very easily put back into a new DataSet. >> >> >> "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message >> news:E1******** *************** ***********@mic rosoft.com... >> > How do I pass a dataset to a webservices? I need to submit a >> > shoppingcart >> > from a pocket PC to a webservice. >> > What is the right datatype? >> > II have tried dataset as a datatype, but I can't get it to compile. >> > <WebMethod()> _ >> > Public Function VerifySku(ByVal skus As XmlDataDocument ) As >> > DataSet >> > >> > Test program : >> > Dim cartSet As DataSet >> > cartSet = ws.VerifySku(ca rtSet) >> > >> > Error: >> > C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of >> > type >> > 'System.Data.Da taSet' cannot be converted to '1-dimensional array of >> > System.Object'. >> > >> > >> >> >>
Scott,
Your second answer is very interesting and I will pursue it.
Your first answer doesn't compile on my computer.
Thanks.
Arne.
"Scott M." wrote: Arne,
If you have data in a DataSet, you have a couple of choices:
1. Just pass the entire DataSet object to a web service web method that takes a DataSet as a parameter. (I don't recommend this approach if the DataSet will be passed between 2 machines in the process because of efficiency).
2. Use the DataSet.GetXML method (which returns an XML string representing the DataSet) and pass that string to a web service web method. Then that web method would declare a new DataSet and using the ReadXML method, it could read the XML string into itself. You will need to load the XML string into an XMLDocument and then pass it to an XMLNodeReader so that it can be read into the DataSet using ReadXML. "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:9E******** *************** ***********@mic rosoft.com... Scott, I reread your two posts, but I am not able to understand your answer. All I am interested in is a datatype to use when sending a dataset to a web services. Would that be an XMLDocument XMLElement XMLDataDocument String or some other hocus pocus. Arne.
"Scott M." wrote:
Arne,
Wow! Thanks for the attitude. Do you want to try again and read my first post and see that the answer you seek is in there?
Hint: "the DataSet's GetXML and ReadXML methods".
Perhaps you could think about what I wrote and try to see how it might fit into your situation.
-Scott
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:E7******** *************** ***********@mic rosoft.com... > Scott, > That is the right answer to the wrong question. I you you read my > question > you will find that I have a problem passing a dataset to a web > services. I > do > not have a problem returning a dataset from a web services. > Do you want to try again to get the right answer? > Arne > > "Scott M." wrote: > >> You are probably better off using the DataSet's GetXML and ReadXML >> methods. >> In other words, the web service returns the xml from a DataSet as a >> string. >> This xml can then be very easily put back into a new DataSet. >> >> >> "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message >> news:E1******** *************** ***********@mic rosoft.com... >> > How do I pass a dataset to a webservices? I need to submit a >> > shoppingcart >> > from a pocket PC to a webservice. >> > What is the right datatype? >> > II have tried dataset as a datatype, but I can't get it to compile. >> > <WebMethod()> _ >> > Public Function VerifySku(ByVal skus As XmlDataDocument ) As >> > DataSet >> > >> > Test program : >> > Dim cartSet As DataSet >> > cartSet = ws.VerifySku(ca rtSet) >> > >> > Error: >> > C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value of >> > type >> > 'System.Data.Da taSet' cannot be converted to '1-dimensional array of >> > System.Object'. >> > >> > >> >> >>
Scott M. wrote: 2. Use the DataSet.GetXML method (which returns an XML string representing the DataSet) and pass that string to a web service web method. Then that web method would declare a new DataSet and using the ReadXML method, it could read the XML string into itself. You will need to load the XML string into an XMLDocument and then pass it to an XMLNodeReader so that it can be read into the DataSet using ReadXML.
Maybe I'm not reading this right, but are you proposing he send it as a string (xsd:string) rather than as a structured XML document? I hope not, because that approach would completely misses the point of XML altogether.
Now, technically you can make your web method signature take/return just DataSet and it should work since DataSet is IXmlSerializabl e. While this is nice that it "just works", it's not necessary optimal and you definitely haven't defined a strongly typed schema for the parameter of your web method. If this is purely a behind the scenes service and you don't expect any clients except your own, then basically you're done because maybe you don't care. However, if this is a service that you expect third parties to integrate with you should be defining a strongly typed schema which you then make sure that the DataSet correctly persists to.
HTH,
Drew
If you are interested in the first approach, just let me see your code for
the 2 methods and I'll bet we can make it work.
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message
news:98******** *************** ***********@mic rosoft.com... Scott,
Your second answer is very interesting and I will pursue it. Your first answer doesn't compile on my computer. Thanks.
Arne.
"Scott M." wrote:
Arne,
If you have data in a DataSet, you have a couple of choices:
1. Just pass the entire DataSet object to a web service web method that takes a DataSet as a parameter. (I don't recommend this approach if the DataSet will be passed between 2 machines in the process because of efficiency).
2. Use the DataSet.GetXML method (which returns an XML string representing the DataSet) and pass that string to a web service web method. Then that web method would declare a new DataSet and using the ReadXML method, it could read the XML string into itself. You will need to load the XML string into an XMLDocument and then pass it to an XMLNodeReader so that it can be read into the DataSet using ReadXML. "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message news:9E******** *************** ***********@mic rosoft.com... > Scott, > I reread your two posts, but I am not able to understand your answer. > All > I > am interested in is a datatype to use when sending a dataset to a web > services. Would that be an > XMLDocument > XMLElement > XMLDataDocument > String > or some other hocus pocus. > Arne. > > "Scott M." wrote: > >> Arne, >> >> Wow! Thanks for the attitude. Do you want to try again and read my >> first >> post and see that the answer you seek is in there? >> >> Hint: "the DataSet's GetXML and ReadXML methods". >> >> Perhaps you could think about what I wrote and try to see how it might >> fit >> into your situation. >> >> -Scott >> >> >> "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message >> news:E7******** *************** ***********@mic rosoft.com... >> > Scott, >> > That is the right answer to the wrong question. I you you read my >> > question >> > you will find that I have a problem passing a dataset to a web >> > services. I >> > do >> > not have a problem returning a dataset from a web services. >> > Do you want to try again to get the right answer? >> > Arne >> > >> > "Scott M." wrote: >> > >> >> You are probably better off using the DataSet's GetXML and ReadXML >> >> methods. >> >> In other words, the web service returns the xml from a DataSet as a >> >> string. >> >> This xml can then be very easily put back into a new DataSet. >> >> >> >> >> >> "Arne" <Ar**@discussio ns.microsoft.co m> wrote in message >> >> news:E1******** *************** ***********@mic rosoft.com... >> >> > How do I pass a dataset to a webservices? I need to submit a >> >> > shoppingcart >> >> > from a pocket PC to a webservice. >> >> > What is the right datatype? >> >> > II have tried dataset as a datatype, but I can't get it to >> >> > compile. >> >> > <WebMethod()> _ >> >> > Public Function VerifySku(ByVal skus As XmlDataDocument ) As >> >> > DataSet >> >> > >> >> > Test program : >> >> > Dim cartSet As DataSet >> >> > cartSet = ws.VerifySku(ca rtSet) >> >> > >> >> > Error: >> >> > C:\Projects\Sho ppingCartWeb\Sh oppingCartTest\ Test.vb(37): Value >> >> > of >> >> > type >> >> > 'System.Data.Da taSet' cannot be converted to '1-dimensional array >> >> > of >> >> > System.Object'. >> >> > >> >> > >> >> >> >> >> >> >> >> >>
This approach works for passing the DataSet schema as well. We can the
DataSet's GetXML and we can use the DataSet's GetXMLSchema to send and then
we can use the DataSet's ReadXMLSchema as well as ReadXML to re-populate.
"Drew Marsh" <dr****@hotmail .no.spamming.co m> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. .. Scott M. wrote:
2. Use the DataSet.GetXML method (which returns an XML string representing the DataSet) and pass that string to a web service web method. Then that web method would declare a new DataSet and using the ReadXML method, it could read the XML string into itself. You will need to load the XML string into an XMLDocument and then pass it to an XMLNodeReader so that it can be read into the DataSet using ReadXML.
Maybe I'm not reading this right, but are you proposing he send it as a string (xsd:string) rather than as a structured XML document? I hope not, because that approach would completely misses the point of XML altogether.
Now, technically you can make your web method signature take/return just DataSet and it should work since DataSet is IXmlSerializabl e. While this is nice that it "just works", it's not necessary optimal and you definitely haven't defined a strongly typed schema for the parameter of your web method. If this is purely a behind the scenes service and you don't expect any clients except your own, then basically you're done because maybe you don't care. However, if this is a service that you expect third parties to integrate with you should be defining a strongly typed schema which you then make sure that the DataSet correctly persists to.
HTH, Drew This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andy |
last post by:
Hello,
I have a WebService that sends a client a DataSet as XML (I use a
DataSet.GetXml to get the XML). The DataSet is filled by a DataAdapter
in the WebService. The client coverts the XML Back to a DataSet (using
StringReader sr = new StringReader(xml); DataSet ds = new DataSet();
ds.ReadXml(sr)).
The client then makes changes to this DataSet, and sends the dirty dataset
back to the WebService using another GetXml on 'ds'.
The...
|
by: JJ |
last post by:
Hi,
I need to pass a dataset to another win form along with a SqldataAdapter.
I don't want to recreate the SqlDataAdapter again either. So to pass to
another Win form in my windows form app, do I create the procedure to pass by
ref? Which means I don't need to add ByRef because it is defaulted by ref,
correct? And in the constructor of the win form that gets created. I need to
add in parameters a DataSet and SqlDataAdapter correct? What...
|
by: Wes Hutton via .NET 247 |
last post by:
I am trying to pass a data object (set or row) into a functionbyref, and have the same issue either way. In the maincontroller function, I have no issues accessing any parts of mydataset. If I extract a data row, it has values and is fine. However, when I pass either the whole dataset or just a data rowto another function, it errors out, and in the Locals windowjust has "error: cannot obtain value" against every field. I'vecopied the code...
|
by: Bob |
last post by:
Hi,
Can anyone tell me how to resolve this:
I am calling a web service from a WinForm app and passing a typed dataset as
a parameter. I have added the dataset to the web service project but I get
an error telling me that the WinForm dataset can't be converted to the web
service dataset - even though they are exactly the same.
How do I get around this? I have tried using CType and DirectCast but always
|
by: GBR |
last post by:
I have a collection object inherited from collection base that is used to
carry my object entities from server to client through a web service. I want
to add a dataset to this collection object and send it across. But when it
gets to the web server, its failing.
Any help would be abvised? Is this possible? Can I add a dataset object and
add it into the collection array and pass it across?
| |
by: Carl Heller |
last post by:
Working in VS2003, .Net 1.1
I'm working on a project where I compare data between two databases. This
is a lengthy process, and very data intensive, so I decided to create a
class, and thread out the work.
The order of work is as follows:
1. Retrieve the data from primary data source
2. Update UI with retrieved data - this is accomplished by passing a
dataset as an event parameter
|
by: zhshqzyc |
last post by:
I am going to past a dataset from First.aspx to Second.aspx.
A whole table will be displayed on First.aspx and partial columns
will be displayed on Second.aspx.
First.aspx view in browser works well if I exclude Second.aspx. But when Second.aspx is included in the project, an error happens.
I can't find what is wrong in my code.
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an...
|
by: John Sheppard |
last post by:
Hello there I was wondering if anyone could help me,
I am trying to pass a typed dataset to a dialoged child form by reference.
I have binding sources sitting on the child form. So to refresh them I just
set their datasource. I am guessing this is probably what is causing the
problem. Is there a better way to do this?
Anyway this all works happily and things show up when the record already
exists but I have 2 problems ;
1) When I add...
|
by: samratds |
last post by:
Hi
We have two server one production and other staging both with fixed ip address ,staging server is inside a firewall and any public computer outside the network cannot see it .I have crystal report running fine in staging with crviewer.
I want to pass a dataset from production to staging so that this dataset become report source in staging and return ,me a pdf report .
since they are different server session object is not working to pass...
|
by: alintt |
last post by:
Hi,
I searched this forum but not found a answer to fit my needs. The problem is: I have 2 forms and one dataset on the parent form who fill a DataGridView. I've passed the dataset to the child form (through a constructor), but now I need the data to be sent back to parent form. The DataSet on the child had some rows removed or added.
DataSet _dSet;
//..........
public Child(DataSet dSet)
{
InitializeComponent();
|
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...
| |
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |