component access XML

Discussions

XML & Web services: component access XML

  1. component access XML (6 messages)

    I need a component to process XML files.we were thinking to make a Ejb component to do this job since we have diffrent client like jsp(web app), powerbuider(c/s) to access the component.but EJB doen't access file system in which we have to put xml files.
    what's the best way to deal with this

    Threaded Messages (6)

  2. component access XML[ Go to top ]

    EJB is serious overkill for processing XML files. Write a normal Java class to do this logic. If a remote machine needs access to the XML, write a servlet that passes the XML to the remote machine in its response (or put the XML file itself in the public_html directory of your web server).
  3. component access XML[ Go to top ]

    Thank you for your reply.
    the remote machine(either jsp or fat client) don't need to access the XML itself,instead,both need to access a component which process the XML,if ejb doesn't process the XML,using normal java class to process the XML, then, I need a interface to communicate with client(may be powerbuilder client) and this XML processing class, what could be act as this interface?
    another question is why EJB designed only work with database but not file system?
  4. component access XML[ Go to top ]

    another question is why EJB designed only work with database but not file system?
    Because, File Systems are Non transactional and also, if your bean component is deployed in a distributed environment, the file system may not be available for all the distributed servers, even if it is available, the Consistancy issues will come.

    Thanks,
    Senthil.
  5. component access XML[ Go to top ]

    Thank you.
    could you provide a solution for my first question:
    I need a interface to communicate with client(may be powerbuilder client) and the XML processing class, what could be act as this interface
  6. component access XML[ Go to top ]

    I can think of 2 things, if you want to implement the component as EJB.

    I. This may require refactoring of your Application.

       1.Create Tables to store XML data as records in database.
       2.Write EJBs to accept XML as Stream object
       3.Write XML->SQL and SQL->XML convertor logic in your bean (If your database supports SQL 2003, it has XML data type, you can directly store XML document, for that you have to wait till the JDBC 4.0 arrival, Ref: http://www.theserverside.com/talks/videos/JohnGoodson/dsl/interview.html)
       4.Access EJBs from your various clients by passing XML information to be stored.

    II. You can store XML as BLOB data type in database, if your database supports and do XMLConvertor logic in your bean.

    Storing and reading XML file from database and parsing will not violate ejb spec because the ejb spec says, you must not use java.io package to read and write in a file system.

    "An enterprise bean must not use the java.io package to attempt to access files and directories in the file system."


    If both of them won't work for you, as Paul pointed out, you can use Servlets to do that.

    Hope this helps,
    Thanks,
    Senthil.
  7. component access XML[ Go to top ]

    Thank you
    if use servlet,what's the best way to be access by fat client such as powerbuilder?