473,756 Members | 4,511 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing a Dataset to a webservice

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'.
Nov 21 '05
22 25600
Your welcome Arne...good luck!
"Arne" <Ar**@discussio ns.microsoft.co m> wrote in message
news:76******** *************** ***********@mic rosoft.com...
Scott and Drew,

I am impressed by your spirited discussion. It may take me a while to try
out all of your suggestions.
Thanks.
Arne.

"Scott M." wrote:
> Well, yeah, that sure might explain it. After all this is the
> microsoft.publi c.dotnet.framew ork.**webservic es** newsgroup. :)


....And it is used by a WebMethod, of a WebService just not from the
client
end, from the back-end that's all. Does that somehow not "qualify" as a
legitmate web service topic? Please!
>
>> What I am
>> proposing would be something that a webmethod would be calling deeper
>> in the n-tier of the server that is running the web service. You
>> don't use WSDL to get these layers communicating since they are both
>> part of the same assembly. You are under the impression I've been
>> describing a web service to web service client, which I have not.
>
> So wait... let us pause to discuss this design for a second:
>
> <digression level="moderate ">
> If this is a deeper layer, why aren't you passing strong types (at
> least
> DataSets) around at that point? Are you actually telling us that you're
> passing strings of XML from a web method written in managed code to a
> data
> layer also written in managed code and doing the parsing within that
> layer? Forget losing strong typing at the web service layer, you seem
> to
> have given that up at a lower level already.


I think you really need to go back and read the posts before you got
involved. I originally suggested that there were 2 ways (that I could
think
of) to address the OP. The first was to pass the DataSet directly. The
OP
said he's having problems doing that and wanted to take a look at my
second
choice. I told the OP that if he wanted to use the first choice
(DataSet),
we'd just need to see his code to determine what he's doing wrong.
>
> The web service should be the one to convert the XML to strongly typed
> data, or at the very least DataSet, before passing it on to the next
> layer? I mean, that's usually the whole point of a Web Service/Method:
> to
> act as a façade over a set of lower level systems. It's entire reason
> for
> existence is to bridge the communication gap. If you're not taking
> advantage of the architecture at that level then what's the point?


I am taking advantage of the Web Service in just the way you describe.
Work
this backwards from the actual data source (in other words, assume the
call
to the web service has already been made and this is how we return data
back
through the web service)...

Data souce gives actual data to Data Layer (this is where we have a
strongly
typed DataSet to hold that data)
Strongly Typed DataSet gives its actual data to a WebMethod
WebMethod (web service) gives its data to a web service client
(serialized)
Client puts its data into a DataSet

The WebSevice could have a strongly typed dataset, but the most important
place for there to be one is in the Data Layer. From there it is very
easy
to persist the structure and data types of the original data up the chan
either by passing a DataSet or by passing the XML and the XMLSchema data.
There is no risk in doing this because the client WILL receive the data
in a
DataSet (either by populating the XMLSchema and XML data or by receiving
a
DataSet with this information intact). I believe you are still thinking
about this thread backwards. The only thing we are saying about the web
service client here is that it will store its data in a DataSet. That
dataset will perform equally well if it gets its data via XMLSchema/Data
or
just by receiving a DataSet.
>
> Finally, if you've built your [B|D]AL into the same assembly as your
> web
> service, well... I don't know what to tell ya there. You've obviously
> got
> some serious architectual decoupling to do and I wish you the best of
> luck.
> </digression>


I'm not sure why you've been so adversarial here. Again, if you had read
the OP and the posts leading up to your first post, you would have seen
that
I advocated a DataSet as the first choice. It's just really frustrating
that you keep wanting to tell me how I'm doing it wrong (and how you are
the
one with all the correct answers) and how I don't understand how web
services, XML and DataSets work, when I believe it is you who isn't quite
up
to speed on what we've been talking about here.
> > Now, on to Arne's problem...
>
>> Allthough, I believe we've found the source of your confusion, the OP
>> did say that DataSets were what he/she intended to use so your point
>> is mute.
>
> C'mon now. Are you seriously trying to fault me for being confused
> about
> you *not talking about web services* on a web services newsgroup in
> response to a web services question? Shame on you.


Uh, yes since I am simply talking about the back end of a web method.
>You can't possibly try to say I'm the one giving the sour advice here


Did I say that? Gee, I don't think I did. In fact, I don't dispute
anything you've said. I've just said that you are talking about a
scenario
that we are not.
>when I was clearly trying to help Arne understand the real choices
>available to him


Pahleeeeese go back and read my 3rd post in this thread. I believe those
are "real" choices as well. And, as a matter of fact, I believe my FIRST
suggestion is the same as yours.
>in web services rather than resorting to passing typeless xsd:any or,
>worse, xsd:string (which is essentially the XML equivalent of void*)
>around.


Well, I guess it's a good thing that I didn't recommend that either. Too
bad you can't read as well as you write.

Why are you being so rude and adversarial? Each time I go back and
explain
what has already been said earlier in this thread, you respond with
something like "Oh, well, in that case...". No one has disputed what
you've
said, I've only said that that's not the scenario that is being
discussed.
>
>> Again Drew, we are talking about situations where DataSets WILL be
>> used.
>
> Yes, I clearly understood that given my detailed example of how the
> DataSet will be represented in schema (by default). In fact, I never
> doubted DataSets were being used here... it's just *how* they're going
> to
> be used that seems to have caused the confusion here.


By your own admission, I really think that you are the only one that's
confused.
>There in lies the problem with your suggestion and ensuing argument: the
>original author *was* talking about using them over webservices (more
>specifically on the wire, not intra/interprocess). The only thing anyone
>has to do to figure this out was read the first line of the original
>request for assistance:
>
> "How do I pass a dataset to a webservices? I need to submit a
> shoppingcart from a pocket PC to a webservice."


Of course, if you had read the other posts, the OP stated that he
couldn't
get that to work and wanted to give the XML road a try. But, you didn't
do
that.
>
> Maybe that's why Arne didn't see your initial suggestion as a useful
> one
> and replied (rightfully so IMHO):
>
> "That is the right answer to the wrong question."


Maybe. But after explaining the 2 scenarios, he decided that the XML
road
might be worth it and thus, we are now talking about that, rather than
the
original track. If you had just done a little more reading and a little
less preaching.....
>
> So, Arne, I at least hope this discussion has been useful to you
> despite
> the alleged "confusion" .


You said you were confused, no one else said anything about it.
>If you need more detail about how to get your DataSet to serialize to
>and
>from a specific XML schema, feel free to ask. As I said originally
>though,
>you might not even care about that if your writing the only software
>that
>is ever going to be a client to the service.


Again, I think the confusion is limited to you. I am really at a loss to
come up with an understanding of why someone who obviously didn't read
the
thread would be so condecending, rude and want to position themself as
the
one who understands what the rest of us don't.

You know these newsgroups are a great place for professionals and novices
to
share thoughts, ideas and strategies. It is not a place for egos and
rudness. You could have made your point(s) in a much less adversarial
way
and avoided the confusion on your part by simply asking for
clarification,
rather than throwing down innuendos and bullying your point.

I wish you good luck (and perhaps some manners too).


Nov 21 '05 #21
So, do we have a conclusion after all the discussions?

Can I retrun a typed dataset as XmlDocument, with full schema AND show
schema in WSDL, without full manual customization?

Most of the solutions on the web is about how to read n well formated xml
data into dataset, couldn't find the other way around.

Please help. Thanks.

"Scott M." <s-***@nospam.nosp am> wrote in message
news:#4******** ******@TK2MSFTN GP10.phx.gbl...
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'.


Nov 21 '05 #22
Whoever wrote:
So, do we have a conclusion after all the discussions?

Can I retrun a typed dataset as XmlDocument, with full schema AND show
schema in WSDL, without full manual customization?

Most of the solutions on the web is about how to read n well formated
xml data into dataset, couldn't find the other way around.

Please help. Thanks.


I replied to your "How to pass a typed dataset to a web service" post, but the short answer is: No, there no way to get the WSDL generator to generate the signature you want for your .NET method signature if you want to use DataSet. You must either generate the WSDL by hand or use specific .NET types decorated with XML serialization attributes that more clearly define what the structure of your document instance should be.

HTH,
Drew
Nov 21 '05 #23

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

Similar topics

1
4314
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...
3
13591
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...
1
1567
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...
2
1463
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
3
3547
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?
2
2596
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
2
3007
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...
4
5931
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...
1
1275
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...
2
3806
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();
0
9455
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
10031
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
9869
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
9838
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
9708
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
5140
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...
1
3805
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
2
3354
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2665
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.