Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB and XML

 
sravanthi adhikari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I was wondering if it is a good way to pass XML objects(instead of strings or other parameters) as parameters to EJB's and access them within ejbs and return back XML objects as results or data from ejbs and use the xml objects for data manipulation or presentation using xsl.
If it's a good way of doing, can u pl direct me to an example where it's being used???
Thanks a lot...
Su
 
greg philpott
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sravanthi,
I think you should take a look at the java api for xml binding: http://java.sun.com/xml/jaxb/index.html
Basically you need to have a DTD to describe instances (xml documents) and you can write a schema to describe how classes should be generated when you run the command line tool.
This will allow you to pass xml objects as parameters and access them in your ejb.
>>can u pl direct me to an example where it's being used???
read this detailed user guide which shows how to use jaxp for a simple checkbook balancing example: http://www.java.sun.com/xml/jaxb/jaxb-docs.pdf
Hope that works for you.
 
sravanthi adhikari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Thanks a lot for the reply.
Sorry for this dumb question. Is there a way to save a result set as an xml object?? I mean , say a function or Bean takes XML object as the input and does some data manipulation( say a search )and returns a result set, how do i pass back this result set as an xml object??? (Say, Microsoft has Recordset.save xmldom adpersitxml).Is there anything similar to this or are there any APIs which have such functions already written?
Thanks in advance.
S
 
greg philpott
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>>Is there a way to save a result set as an xml object??
yes, The generator of the result set should make the result set in xml. If this is not possible, then this involves work and you will have to implement methods to read the resultset and extract data values you need
>>say a function or Bean takes XML object as the input and does >>some data manipulation( say a search )and returns a result >>set, how do i pass back this result set as an xml object?
why can't the function or bean return a result set as an xml document? that would be the most desirable solution
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic