You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jeremy Isikoff <ji...@yahoo.com> on 2007/08/01 05:34:25 UTC

Good way to return a RowSet from a service?

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(JAXBContextInitializer.java:130)
at org.apache.cxf.jaxb.JAXBContextInitializer.addClass(JAXBContextInitializer.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/

RE: Good way to return a RowSet from a service?

Posted by "Liu, Jervis" <jl...@iona.com>.
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:glen.mazza@verizon.net]
Sent: 2007?8?3? 10:39
To: cxf-user@incubator.apache.org
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

Re: Good way to return a RowSet from a service?

Posted by Glen Mazza <gl...@verizon.net>.
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/
> 


Re: Good way to return a RowSet from a service?

Posted by Daniel Kulp <dk...@apache.org>.
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/

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog