Sorry if this is getting a bit off topic...I know in .Net a dataset is XML serializable no problem with both schema and data and I'm coming from .net and moving to java
What I'm doing is running scheduled queries on a server and then need to feed them to a client that charts this data at a later time. I need to 1) store the results in the server db in some serialized format probably as xml in a clob and 2) return them to the client over a webservice I was thinking WebRowSet would be useful for this but I couldn't manage to get it to work.I tried returning a WebRowSetImpl directly from a webservice but it wouldnt make thorugh JAXB. I'm thinking now of making a dumb wrapper for it and just using its WriteXML method to write itself into a string property in the wrapper instead. Like I said Im coming from .Net and Im used to classes implementing XMLSerializable which is what is naturally called when a web service tries to serialize their data. So the crux of the problem really is how to get rowset data and schema across the wire without writting a brand new class and why WebRowSet doesnt seen to work for this? ----- Original Message ---- From: "Liu, Jervis" <[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, August 2, 2007 11:53:34 PM Subject: RE: Good way to return a RowSet from a service? It looks like you are trying to do some kind of Database Web services. I am afraid in the world of Database web services, you would never want to return RowSet directly because RowSet object is too complex/big to be mapped to XML, not to mention other concerns like performance etc. Many database vendors and web services framework vendors have done a lot in the Database web services area. There are two most common approaches. One is you map JDBC types to XML types (and vice versa) either by an O/R mapping framework (like Hibernate) or by yourself. Take an example, if you have a SQL statement "SELECT employee_name from employee where employee_id=?", this can be mapped to an operation in your WSDL, and the corresponding java operation is String getEmployeeName(String employeeID). When a request coming said I want to invoke getEmployeeName with a string parameter, the web service stack will first dispatch the incoming SOAP message to getEmployeeName(String employeeID) method, then the DB web service code (you write this piece of code or it is a functionality provided by DB web service vendor) maps employeeID to JDBC type then invoke the SQL of "SELECT employee_name from employee where employee_id=?". Of course this is just a version simplified for the purpose illustration, the real process can be more complex. Another approach is to utilize the XML database or XML interface provided on top of traditional database. Now that the output of database is already in XML format, it is just a simple matter how you expose certain DB queries appropriately as web services and how you organize the result and return it back. This is indeed a very interesting topic, especially when this offering is combined with REST. Think about it this way, database in its nature, is a resource repository. All these SQL queries do is to navigate among resources (i.e., tables, columns.). This is exactly what REST is. I am personally very interested in this topic and would like to see how we can explore this potential using CXF REST support. Sth similar to what Microsoft Astoria is done [1]. If you have any comments or suggestions, I would be very happy to hear from you. Let me know if this answered your question. [1]. <http://astoria.mslivelabs.com/Overview.doc> http://astoria.mslivelabs.com/Overview.doc Jervis -----Original Message----- From: Glen Mazza [ mailto:[EMAIL PROTECTED] Sent: 2007?8?3? 10:39 To: [email protected] Subject: Re: Good way to return a RowSet from a service? Mark Hansen's pretty-good-if-tad-bit-pricey SOA book ( http://www.soabook.com/) covers XmlAdapters in a fair amount of detail on p.245-256, although I'm not certain it would solve the user's problem here. Glen Am Donnerstag, den 02.08.2007, 12:54 -0400 schrieb Daniel Kulp: > This is actually an "interesting" question that's been on my "todo" list > to investigate for ages. It relates to things like HashMaps and such. > > The JAXB Javadoc describes some stuff about XmlAdapters: > http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/adapters/XmlAdapter.html > that supposedly could be used to map non-jaxb objects into objects that > JAXB can understand. That javadoc describes a sample thing for > HashMaps, but I haven't actually tried doing it to see how it would work > or how to integrate it into CXF. > > Dan > > > > On Tuesday 31 July 2007 23:34, Jeremy Isikoff wrote: > > Hi all, I'm trying to return a RowSet (data and schema info) from a > > cxf webservice. I tried returning instances of CachedRowSetImpl or > > WebRowSetImpl directly but they both cause stack overflows when > > deploying to tomcat. Is there some better way to do this or do I have > > write my own class? > > > > > > java.lang.StackOverflowError > > at java.lang.Class.privateGetDeclaredFields(Class.java:2278) > > at java.lang.Class.getDeclaredFields(Class.java:1743) > > at > > org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitial > >izer.java:130) at > > org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitial > >izer.java:131) at org.apache.cxf.jaxb.JAXBContextInitializer.a > > > > > > > > ______________________________________________________________________ > >______________ Looking for a deal? Find great prices on flights and > > hotels with Yahoo! FareChase. http://farechase.yahoo.com/ > ---------------------------- IONA Technologies PLC (registered in Ireland) Registered Number: 171387 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland ____________________________________________________________________________________ Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games. http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
