1 2 Previous Next 26 Replies Latest reply on Jul 6, 2009 9:28 AM by Marco Gralike

    XML DB as a RESTful interface?

    475642
      Hi!
      We are thinking about offering http (RESTful) access to some departments in our
      company.
      However, all our data sits in "normal" database tables.
      The benefit is that it needs absolutely no installation effort on the clients, we just provide some example VBScripts using MSXML and our customers cann access the data.
      Access control is supposed to be done using kerberos and row level security.

      So, "we", the inside people and views/packages in other database schemas will mostly use SQL and PL/SQL to upload and process data, but the people of the other departments (the "others") will be using http.

      We are just learning to start about web services and such and I'm wondering whether XML DB can offer us something here.

      Basically we plan to do this:
      - connect using http (typically msxml)
      - accessing data like
      * http://ourapp...com/partsdb/partsbyname/part_x (delivers XML with all attributes, the node data and hrefs to child nodes)
      * http://ourapp...com/partsdb/partsbyname/resistor5K/cost (delivers <cost unit="EUR">0,05</cost>)
      * http://ourapp...com/partsdb/partsbyname/resistor5K/datasheet (delivers a pdf document as mime type "application/pdf")
      and so on.

      I guess I can probably map the tables into hierarchical XML views. But is this suitable for the XML repository folder metaphor? Can I map the tables into a folder structure so that XML DB can serve "get" requests with paths at all?

      I'd like to do puts, posts and deletes too, each mapped to the corresponding update/insert/delete statements on the underlying table.
      For such requests how to get from a URL path to the corresponding table(s)?
      Would resource_view and path_view help me? I've read about using instead of triggers in such a situation. Can I even access the path in an instead of trigger?

      If possible at all I'd like to avoid oracle AS. If I need it then still I'd like to keep as much as possible of the application in the database.

      Any help is appreciated.

      Lots of Greetings!
      Volker
        • 1. Re: XML DB as a RESTful interface?
          mdrake-Oracle
          Have you looked at the dburi servlet ?

          Eg

          http://localhost/oradb/SCOTT/EMP

          In 11g we will support Database native Web Services..
          • 2. Re: XML DB as a RESTful interface?
            475642
            Hi!
            I just had a look. I'm not sure how much dburi helps me. It apparently can access single tables but we don't want just to put the tables (or views) on the intranet.
            Instead we'd like to have a nice hierarchical structure with two or three entry points (like parts, printed circuit boards and project teams) that essentially access the same data by traversing different hierarchies.
            This is natural in an entity relationship model but we are going to need three hierarchies for the REST API. This is fine by us as long as this is just views and triggers for the relational data.
            But what I'm interested in, given an update request to http...partsdb/parts/part_x/datasheet, mime type "application/pdf", what happens in XML DB, when the table structure is like this:
            create table parts (name varchar2(50), doc_id number(20);
            create table docs(doc_id number(20), doc_type varchar2(50), doc BLOB);

            Doesn't something somewhere need to extract the "part_x" folder name?
            How would this normally work?
            I'm clueless about this folder thing in XML DB ("repository"?) and how to properly use it.
            In particular how to map a table structure into a repository, not just a single XML document.

            As for 11g, I've heard rumors. Are there any white papers or other information? I'm really interested in how the database intends to reclaim the middle tier.

            Lots of Greetings!
            Volker
            • 3. Re: XML DB as a RESTful interface?
              mdrake-Oracle
              Where are you located... ?
              • 4. Re: XML DB as a RESTful interface?
                475642
                Germany (Augsburg, Bavaria) and it's half past ten pm.
                I'm leaving for today.

                Good night! :-)

                Volker
                • 5. Re: XML DB as a RESTful interface?
                  mdrake-Oracle
                  I'll be in Munich for the next 2 weeks, starting Monday. Maybe we can talk further while I'm in your time zone. If you're interested can you send me some contact info to mark_DOT_drake_AT_oracle_DOT_com
                  • 6. Re: XML DB as a RESTful interface?
                    Marco Gralike
                    If you mean REST as described here http://www.xfront.com/REST-Web-Services.html, then I am not sure if will work (Mark should be able to give you an insight). I am wrestling with the idea for some time now (read the article 1/2, 1 year ago) and I would be interested if it could be done and/or if it will perform. Please let us now here of the outcome. Thanks
                    • 7. Re: XML DB as a RESTful interface?
                      Marco Gralike
                      Mark btw, will you be in the Netherlands this year, as well?
                      • 8. Re: XML DB as a RESTful interface?
                        475642
                        Yes, that's what I mean.
                        I've got book http://www.oreilly.com/catalog/9780596529260/ on order and will see how it goes.
                        Currently I'm wrestling with a few dilemmas:
                        - how much effort to put into an elaborate hierarchy?
                        - just links to flat collections (/projects, /datasets, /documents) and navigation by links? REST seems to emphasize the navigational approach.
                        - XDBUris are great and much more powerful than the folder part of the URI. But if I go to extremes and put the whole thing as /one/ XML document with navigation by XPATH expressions, any update changing more than a scalar causes XML DB to "construct the whole document in memory" according to the documentation.
                        - if I work with a folder structure I'm goint to have to maintain it as mirror of the relational tables, for instance, if I create a new project (insert into relational table) I'm going to have to create a ressource and a bunch of folders for the URI approach to work. Basically I'm copying data and that I do not like.

                        So, some of the problems I still see are,
                        - Can I have more control over the folder ands ressource thing? In particular, can I do a relational view that is hierarchical (connect_by and so on) and gets treated by XML DB as folder structure?
                        - If there's an update (updateXML()), can I map this to relational updates without the whole XML constructed in memory or without a complete replace?

                        As for how it will perform, yes, I'm interested in this too :-)

                        I'll let you know.

                        Lots of Greetings!
                        Volker
                        • 9. Re: XML DB as a RESTful interface?
                          Marco Gralike
                          What about setting up a XMLSchema that defines you "REST" structure, Create a fully linked Object relational table based on this schema and then auto-generate your REST (meta data file/directory) structure by just inserting rows into the OR table...(I know it sounds vague ;-)

                          Message was edited by:
                          mgralike
                          • 10. Re: XML DB as a RESTful interface?
                            475642
                            That's what we are trying to do. However, I'm still reading up on the whole Schema stuff and I don't know whether one schema can define a whole structure consisting of several documents and folders.

                            But if what you say is possible it's certainly a nice and elegant solution.

                            Lots of Greetings!
                            Volker
                            • 11. Re: XML DB as a RESTful interface?
                              Greg Jarmiolowski
                              Some newer info that may help others who find this thread:

                              http://marceloochoa.blogspot.com/search/label/REST
                              • 12. Re: XML DB as a RESTful interface?
                                Marco Gralike
                                One of the reasons why Marcelo is already a long time on my blogroll

                                ;-)
                                • 13. Re: XML DB as a RESTful interface?
                                  Greg Jarmiolowski
                                  Hopefully Oracle will bake this in. Maybe with WSDL 2.0 support.
                                  • 14. Re: XML DB as a RESTful interface?
                                    Marco Gralike
                                    I wonder. Oracle is following the official accepted W3C / SOA standards. Could be a while before REST makes on that front
                                    1 2 Previous Next