473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

DataSet and Platform Dependency

Hi,

We are having a debate over using DataSet as return value type for web
services.

The problem is that we don't know whether Java applications can use DataSet
or not.

Can we count on the fact that java supplications can consume asp.net web
services that return Dataet?

If the answer is NO, then what is the best practice? What it the best way to
return table structure data from a asp.net web service to a Java based
client?

A link to online resource will solve our problem.

Any help would be appreciated,

Max
Oct 3 '06 #1
13 2312
Hello Max,

From your description, you're developing a webservice which will return
datas from tables in backend database and currently you're meet problem on
determine how to return the data to webservice client, through dataset or
other XML format, correct?

As you mentioned that your webservice will be visited by other non-DOTNET
platform, I think using DataSet does will cause some interopability issue.
Actually, you're not totally prohibited from using DataSet, you can return
those data as a DataSet with dataTables, and they'll be serialized as XML
content, and the webservice client can correctly accept such XML content
(in SOAP message). However, the problem here is that those non-dotnet
client(such as java) can not have a corresponding class like DataSet, so it
can not derserialize the DataSet's XML content back into object instance.
And in such cases, you can only use the DataSet as a normal XML Document
and use XML api(such as DOM) to query data items from it.

I'm not sure whether O-R mapping is adoptable here for your scenario. It is
common that we created some custom classes(with properties) to represent
data tables in datatable. And when we query records from database table, we
convert them as custom class's instance collection and return those custom
class object collection to client. Also, for both dotnet or non-dotnet
webservice platform, there're interfaces for mapping custom class to a
certain XML format (just like the XML Serialization in .net), you can
define a contract between service and client so that your .net custom
classes will be serialized as certain format of XML content and the
non-dotnet client can also deserialize them to class instances.

Here are some web reference discussing on such topics(called contract-first
webservice design-pattern):

#Contract-First Web Services with Apache Axis2
http://today.java.net/pub/a/today/20...b-services-wit
h-axis2.html

#Techniques for Contract-First Development
http://msdn.microsoft.com/msdnmag/is...erviceStation/

#Contract First Web Services Interoperability between Microsoft .NET and
IBM WebSphere
http://msdn.microsoft.com/vstudio/ja...p/default.aspx

Hope this helps some.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.



Oct 3 '06 #2
Hello,

I recently had to integrate a .NET Web Service with a Progress application.
The Web Service passed a DataSet to the Progress app. Someone else took care
of the Progress side but basically Progress provide a thing called Open
Client which allows the ceration od References as dll's which can be
incorporated into the .NET project to allow calls to be made between .NET and
Progress apps. This allows for easy passing of objects such as DataSets. It
worked very well. There may well be a tool for Java which does something
similar. In fact, it may be more likely seeing as Java is a bit more popular
than Progress nowadays, however that is just a guess.

hth in some way,

Best ,
David

"Maxwell2006" wrote:
Hi,

We are having a debate over using DataSet as return value type for web
services.

The problem is that we don't know whether Java applications can use DataSet
or not.

Can we count on the fact that java supplications can consume asp.net web
services that return Dataet?

If the answer is NO, then what is the best practice? What it the best way to
return table structure data from a asp.net web service to a Java based
client?

A link to online resource will solve our problem.

Any help would be appreciated,

Max
Oct 4 '06 #3
Hi David,

Thank you for help. Your scenario works perfect in windows platform;
however, I am not sure that you can do the same in AIX or Solaris. Our
client doesn't want to be bound to windows platform.

Thank you,

Max

"David++" <Da***@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
Hello,

I recently had to integrate a .NET Web Service with a Progress
application.
The Web Service passed a DataSet to the Progress app. Someone else took
care
of the Progress side but basically Progress provide a thing called Open
Client which allows the ceration od References as dll's which can be
incorporated into the .NET project to allow calls to be made between .NET
and
Progress apps. This allows for easy passing of objects such as DataSets.
It
worked very well. There may well be a tool for Java which does something
similar. In fact, it may be more likely seeing as Java is a bit more
popular
than Progress nowadays, however that is just a guess.

hth in some way,

Best ,
David

"Maxwell2006" wrote:
>Hi,

We are having a debate over using DataSet as return value type for web
services.

The problem is that we don't know whether Java applications can use
DataSet
or not.

Can we count on the fact that java supplications can consume asp.net web
services that return Dataet?

If the answer is NO, then what is the best practice? What it the best way
to
return table structure data from a asp.net web service to a Java based
client?

A link to online resource will solve our problem.

Any help would be appreciated,

Max

Oct 4 '06 #4
Hi,

Another thing I did which might work is to pass the DataSet as a string of
XML. For example -

[WebMethod]
public string GetDataSetAsStringOfXml()
{
DataSet ds = new DataSet();

// Populate the DataSet with data

// Get the XML for the dataset and load into a string
string s = ds.GetXml();

// returnthe string
return s;
}

Now, Java should understand the string? I have no experience in your
platform so I dont know. But, once you have the string you can then write it
as XML, and then you essentially have the DataSet and all its data in XML
format. Then Java can read that XML file and construct Java version of
DataSet.

Or perhaps Java can read the string of xml directly -

readXml
public void readXml(java.lang.String xml)Loads DataSet data from an XML
Document in String format; when complete, the DataSet will have been
populated from the Document.

Parameters:
xml - The XML Document, as a String.

But, I dont know for sure what is the best way or best practise. Still
learning here!

David

"Maxwell2006" wrote:
Hi David,

Thank you for help. Your scenario works perfect in windows platform;
however, I am not sure that you can do the same in AIX or Solaris. Our
client doesn't want to be bound to windows platform.

Thank you,

Max

"David++" <Da***@discussions.microsoft.comwrote in message
news:80**********************************@microsof t.com...
Hello,

I recently had to integrate a .NET Web Service with a Progress
application.
The Web Service passed a DataSet to the Progress app. Someone else took
care
of the Progress side but basically Progress provide a thing called Open
Client which allows the ceration od References as dll's which can be
incorporated into the .NET project to allow calls to be made between .NET
and
Progress apps. This allows for easy passing of objects such as DataSets.
It
worked very well. There may well be a tool for Java which does something
similar. In fact, it may be more likely seeing as Java is a bit more
popular
than Progress nowadays, however that is just a guess.

hth in some way,

Best ,
David

"Maxwell2006" wrote:
Hi,

We are having a debate over using DataSet as return value type for web
services.

The problem is that we don't know whether Java applications can use
DataSet
or not.

Can we count on the fact that java supplications can consume asp.net web
services that return Dataet?

If the answer is NO, then what is the best practice? What it the best way
to
return table structure data from a asp.net web service to a Java based
client?

A link to online resource will solve our problem.

Any help would be appreciated,

Max


Oct 4 '06 #5
Since DataSet is a .NET-specific type, you should return something platform
independent.

The earlier poster's suggestion about returning ds.GetXml() will work in
many cases (though I generally recommend against returning XML strings as
CDATA blocks - define a schema and return XML that matches the schema
instead).

In some cases, with multiple tables, the output of GetXml isn't going to
make much sense to your client. In that case, you may want to return the
DataSet as a sequence of the individual tables.

And, again, schema, schema, schema...

John
Oct 4 '06 #6
I agree that manipulate the DataSet's output xml as plain XML content
(through standard XML api) is a reasonable means if you do not want to
define custom business classes to mapping database table/rows as I
mentioned in the last reply.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 9 '06 #7
You know, the problem would be solved if MS would just provide a way to
serialize the schema of the DataSet to a 'non-MS' schema that could be used
by anyone (any language). While it looks like it's cleaner in .NET 2.0, it's
still not there.

David McCarter
VB.NET MVP
"Steven Cheng[MSFT]" wrote:
I agree that manipulate the DataSet's output xml as plain XML content
(through standard XML api) is a reasonable means if you do not want to
define custom business classes to mapping database table/rows as I
mentioned in the last reply.
Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights
Oct 9 '06 #8
"dotNetDave" <do********@discussions.microsoft.comwrote in message
news:3C**********************************@microsof t.com...
You know, the problem would be solved if MS would just provide a way to
serialize the schema of the DataSet to a 'non-MS' schema that could be
used
by anyone (any language). While it looks like it's cleaner in .NET 2.0,
it's
still not there.
What's wrong with the schema?

John
Oct 9 '06 #9
This issue is that it has Microsoft or DataSet specific tags in it. To me, to
be truly interoperable, the WSDL or schema should be very generic, i.e. no
indication what language created it. You can read more of what I mean on my
blog:

http://blog.davidmccarter.net/PermaL...2d14b80e6.aspx

David

"John Saunders" wrote:
"dotNetDave" <do********@discussions.microsoft.comwrote in message
news:3C**********************************@microsof t.com...
You know, the problem would be solved if MS would just provide a way to
serialize the schema of the DataSet to a 'non-MS' schema that could be
used
by anyone (any language). While it looks like it's cleaner in .NET 2.0,
it's
still not there.

What's wrong with the schema?

John
Oct 10 '06 #10
"John Saunders" wrote:
Since DataSet is a .NET-specific type, you should return something platform
independent.

The earlier poster's suggestion about returning ds.GetXml() will work in
many cases (though I generally recommend against returning XML strings as
CDATA blocks - define a schema and return XML that matches the schema
instead).

In some cases, with multiple tables, the output of GetXml isn't going to
make much sense to your client. In that case, you may want to return the
DataSet as a sequence of the individual tables.

And, again, schema, schema, schema...

John
Hi John,

Thanks for the tips. I'm curious to know what form would the returned XML
would take?When you say -

"define a schema and return XML that matches the schema instead"

How would you do this?

I'm aware that Web Services are ultimately SOAP messages which are XML and
the data within is always serialized and wrapped in XML, but when you go to
return the DataSet as a generic type, in what form would your DataSet be
returned?

Many thanks for any further info.
Best,
David
Oct 11 '06 #11
"David++" <Da***@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
"John Saunders" wrote:
>Since DataSet is a .NET-specific type, you should return something
platform
independent.

The earlier poster's suggestion about returning ds.GetXml() will work in
many cases (though I generally recommend against returning XML strings as
CDATA blocks - define a schema and return XML that matches the schema
instead).

In some cases, with multiple tables, the output of GetXml isn't going to
make much sense to your client. In that case, you may want to return the
DataSet as a sequence of the individual tables.

And, again, schema, schema, schema...

John

Hi John,

Thanks for the tips. I'm curious to know what form would the returned XML
would take?When you say -

"define a schema and return XML that matches the schema instead"

How would you do this?

I'm aware that Web Services are ultimately SOAP messages which are XML and
the data within is always serialized and wrapped in XML, but when you go
to
return the DataSet as a generic type, in what form would your DataSet be
returned?
David, the simple answer is, "create a sensible schema and then build the
XML to return however you like". Of course, that's too simple.

First of all, be aware that you can have your web service method return
XmlElement. I don't have time to look for it, but there's an article on this
on MSDN.

Second, given that you can return an XmlElement, you can return whatever XML
you like.

Third, if you had a schema, then you might "like" to return XML matching the
schema.

So, basically, your web service method becomes a matter of creating the XML
you'd like to return (however you like to do this), and then returning it.

I've personally used several different mechanisms to build the XML to
return, sometimes more than one in the same method. For instance, one method
built up the skeleton of the response using XmlDocument.CreateElement /
..AppendChild, and then part of the contents were filled in with XML
serialization. Some of the contents are created by taking the result of an
XML transform.

The bottom line is that you don't need to be a slave to how .NET wants to
serialize (or deserialize) XML into and out of .NET data types. You can use
XML directly and take control of the process.

This is especially interesting in your case, where you're trying to return
"a DataSet" to clients which have no concept of a DataSet (DataSet being
specific to .NET). Instead, define a schema which represents the data as
you'd like the clients to see it. This could, for instance, be a
denormalized form (clients which don't know about DataSet are less likely to
be able to resolve child relations).
I hope that helps, and doesn't make it worse!

John

P.S. I _do_ have to admit, that I had a learning curve to get over before I
could do this for my web service. I hadn't done much more than read XML
Schema before, so I had to do some research. It was worth it, though!
Oct 11 '06 #12
"John Saunders" wrote:
"David++" <Da***@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
"John Saunders" wrote:
Since DataSet is a .NET-specific type, you should return something
platform
independent.

The earlier poster's suggestion about returning ds.GetXml() will work in
many cases (though I generally recommend against returning XML strings as
CDATA blocks - define a schema and return XML that matches the schema
instead).

In some cases, with multiple tables, the output of GetXml isn't going to
make much sense to your client. In that case, you may want to return the
DataSet as a sequence of the individual tables.

And, again, schema, schema, schema...

John
Hi John,

Thanks for the tips. I'm curious to know what form would the returned XML
would take?When you say -

"define a schema and return XML that matches the schema instead"

How would you do this?

I'm aware that Web Services are ultimately SOAP messages which are XML and
the data within is always serialized and wrapped in XML, but when you go
to
return the DataSet as a generic type, in what form would your DataSet be
returned?

David, the simple answer is, "create a sensible schema and then build the
XML to return however you like". Of course, that's too simple.

First of all, be aware that you can have your web service method return
XmlElement. I don't have time to look for it, but there's an article on this
on MSDN.

Second, given that you can return an XmlElement, you can return whatever XML
you like.

Third, if you had a schema, then you might "like" to return XML matching the
schema.

So, basically, your web service method becomes a matter of creating the XML
you'd like to return (however you like to do this), and then returning it.

I've personally used several different mechanisms to build the XML to
return, sometimes more than one in the same method. For instance, one method
built up the skeleton of the response using XmlDocument.CreateElement /
..AppendChild, and then part of the contents were filled in with XML
serialization. Some of the contents are created by taking the result of an
XML transform.

The bottom line is that you don't need to be a slave to how .NET wants to
serialize (or deserialize) XML into and out of .NET data types. You can use
XML directly and take control of the process.

This is especially interesting in your case, where you're trying to return
"a DataSet" to clients which have no concept of a DataSet (DataSet being
specific to .NET). Instead, define a schema which represents the data as
you'd like the clients to see it. This could, for instance, be a
denormalized form (clients which don't know about DataSet are less likely to
be able to resolve child relations).
I hope that helps, and doesn't make it worse!

John

P.S. I _do_ have to admit, that I had a learning curve to get over before I
could do this for my web service. I hadn't done much more than read XML
Schema before, so I had to do some research. It was worth it, though!
Hi John,

Thanks for the reply and information. I think this topic is really important
to the discussion of real use of web Services as this type of thing is
ultimately going to crop up quite often so it is good to have some discussion
about it, so thanks a lot for sharing your knowledge! I think it is time for
me to go through the learning curve now with this issue, so thanks for giving
me some stuff to get going..

Cheers,
David
Oct 12 '06 #13
Hi Maxwell,

This might be a bit too late for you - I read your post only today - but
here are some ideas if you're still interested.

You shouldn't return a Dataset from a web service, among other things for
the reasons you've mentioned. However, you could use a Dataset on the inside
and have it returned pure XML - without any notion of MS or Datasets - by
creating a clean XSD Schema containing exactly what you want to transfer.

Before filling the new dataset, attach the XSD Schema to it. This makes
ADO.NET build the dataset's structure in accordance with the schema. Then
fill the dataset, binding SQL columns to dataset columns.

To return the content of the dataset as pure XML, based on the schema,
declare an XMLDoc variable (retVal). Then set that variable to point on a new
XMLDataDocument based on the dataset. Finally just return retVal from the web
service.

A drawback is that the WSDL won't publish the schema, you'll have to do that
by other means. The WSDL data type is just XML.

You could also consider using XSD.EXE to generate one or more message
classes from your schema. Long term, this is probably a better solution.

"Maxwell2006" wrote:
Hi,

We are having a debate over using DataSet as return value type for web
services.

The problem is that we don't know whether Java applications can use DataSet
or not.

Can we count on the fact that java supplications can consume asp.net web
services that return Dataet?

If the answer is NO, then what is the best practice? What it the best way to
return table structure data from a asp.net web service to a Java based
client?

A link to online resource will solve our problem.

Any help would be appreciated,

Max
Oct 19 '06 #14

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

Similar topics

0
by: pervinder | last post by:
Hi, I have a c++ application which depends on some other libs which uses stlport When i build the application, it works fine on sun/linux/hp platform. (provided the .a for the dependency libs) ...
4
by: geilen | last post by:
I'm trying to use a dataset returned from a web service in an unmanaged C++ (MFC) client. The dataset is returned as a BSTR, and I'm having trouble reading the BSTR into an XML document for...
3
by: news.microsoft.com | last post by:
The question is, is a DataSet CLS compliant? Minimally implemented code, with an attribute in the assemblyinfo.cs compiles just fine (is it possibly the data INSIDE the dataset that could...
3
by: DJTN | last post by:
I'm getting the following error when I try to compile my setup project in VS 2002. I have re-installed the .net framework 1.1 and it didnt solve the problem. WARNING: Unable to find dependency...
6
by: Jumping Matt Flash | last post by:
The code i'm writing is using VB .NET and is for a web service returning a dataset, which is in turn to be used by an ASP .NET application displaying a datagrid. I'm currently populating a...
8
by: flyingleon | last post by:
I have today downloaded gcc-4.1.1 and tried to configure and build it. I have successfully done this before with gcc-3.4.2. The gcc-4.1.1 includes gfortran which is a language that I need. The...
7
by: Mike9900 | last post by:
If you do .NET Remoting and Binary Serilization with DataSet it does not work. If you set the Serialization type to Binary on DataSet, it does not seralize it correctly on windows xp. To do this...
15
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 ...
1
by: Sparky74 | last post by:
Has anybody managed to play an AVI file in .NET without a dependency on DirectX or Windows Media player? I'm trying to write an application that will run irrespective of OS/platform. All the examples...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.