aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Sending a xml file as a method parameter to a session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Sending a xml file as a method parameter to a session bean" Watch "Sending a xml file as a method parameter to a session bean" New topic
Author

Sending a xml file as a method parameter to a session bean

Megan Hill
Greenhorn

Joined: Jul 21, 2002
Posts: 7
Hi,
I need to send a xml file to a session bean as a parameter of a method.
How do I do it?
Thanks,
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Pass the contents of the XML file as a String.
selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115
why not as InputStream?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
An InputStream is not Serializable, as all EJB arguments must be. A String is.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
Megan Hill
Greenhorn

Joined: Jul 21, 2002
Posts: 7
Thanks for the replies.
I will send it as a String.
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
Hold on pardner! Just because you CAN pass an XML file as a String doesn't mean you should! In fact, I would consider this to be a REALLY BAD idea...
Think about it this way -- an EJB call is a potentially remote call. The very idea of taking an XML string (which represents object data) and passing it into an EJB to be parsed is pretty outrageous -- why incur all of that parameter passing overhead by passing all that extra stuff over the network?
Instead, I tend to lean STRONGLY towards doing all of the XML parsing on the other side of the remote interface (in the client, be it a servlet, Java application, or Message Driven Bean) and then creating a Serializable Java object (a Value Object) to hold the results and then passing that to the EJB. It fits better with the EJB architecture, and will usually be significantly faster.
Kyle
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Sending a xml file as a method parameter to a session bean