Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML To Dataset
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01303148
Message ID:
01303526
Views:
22
>>>>>I'm doing an app which is initially a C# WinForms app where the users will connect via VPN.
>>>>>At some point in the future it will be converted to a web app, so I want to use a WS up front.
>>>>>
>>>>>I'm fairly new at this, and I've seen some examples, as well as prior postings with you and Bonnie
>>>>>that got me going this way.
>>>>>
>>>>>I didn't think you could pass a dataset through a WS into the back end.
>>>>
>>>>.NET to .NET you can pass pretty much anything. As long as the client understands the type it can be completely transparent.
>>>>
>>>>But, as I said to Mike, if you anticipate that non-NET clients will be using your WS then passing back a DataSet as XML is not particularly consumer friendly.
>>>>OTOH (and I don't know if it's just me but) I find I'm dealing with a lot of web services that do just that. Great if you're a .NET consumer; pain if you're not......
>>>
>>>
>>>Not sure I understand. You're saying that XML is not consumer friendly?
>>
>>I'm saying a DataSet converted to XML is not friendly for a non-.NET consumer.
>>
>>If your web service returns a Dataset object it is automatically converted to XML by the .NET plumbing (so there's not much point in going through the .WriteXML() step). A .NET client can simply cast this back to a Dataset which is great. But a non-.NET client if faced with parsing an overly complex and verbose piece of XML when a far simpler representation of the data could be provided
>>HTH,
>>Viv
>
>Such as?
For example this:
<?xml version="1.0" encoding="utf-8" ?> 
<People>
  <Person>
    <FirstName>Fred</FirstName>
    <LastName>Bloggs</LastName>
  </Person>
  <Person>
    <FirstName>Joe</FirstName>
    <LastName>Smith</LastName>
  </Person>
</People>
instead of:
  <?xml version="1.0" encoding="utf-8" ?> 
 <DataSet xmlns="http://tempuri.org/">
 <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
 <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
 <xs:complexType>
 <xs:choice minOccurs="0" maxOccurs="unbounded">
 <xs:element name="People">
 <xs:complexType>
 <xs:sequence>
  <xs:element name="FirstName" type="xs:string" minOccurs="0" /> 
  <xs:element name="LastName" type="xs:string" minOccurs="0" /> 
  </xs:sequence>
  </xs:complexType>
  </xs:element>
  </xs:choice>
  </xs:complexType>
  </xs:element>
  </xs:schema>
 <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
 <NewDataSet xmlns="">
 <People diffgr:id="People1" msdata:rowOrder="0" diffgr:hasChanges="inserted">
  <FirstName>Fred</FirstName> 
  <LastName>Bloggs</LastName> 
  </People>
 <People diffgr:id="People2" msdata:rowOrder="1" diffgr:hasChanges="inserted">
  <FirstName>Joe</FirstName> 
  <LastName>Smith</LastName> 
  </People>
  </NewDataSet>
  </diffgr:diffgram>
  </DataSet>
Admittedly in this case it would make more sense to return a DataTable rather than a DataSet but.....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform