webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Simple update

    Posted Fri November 09, 2001 02:51 AM

    I am unsure, what I am missing. I am doing a simple update using the code below. The update never happens.

    My tamino results look like -

    Message Text: Element/attribute name not found
    Message Line:
    Ino Code : INOXRE8814


    TaminoClient tamino = new TaminoClient(“http://localhost/tamino/Perf/PO1M”);
    tamino.startSession();
    String tq = “/polist/po[5]/lineitems/lineitem[1]/item”;
    TaminoResult tr = tamino.query(tq);
    Document doc = tr.getDocument();
    Element item= (Element)tr.getElement).getFirstChild();
    Element price = (Element)item.getElementsByTagName(“price”).item(0);
    price.getChildNodes().item(0).setNodeValue(“$9999”);
    TaminoResult tr2 = tamino.update(item);
    System.out.println(“item=” + item);
    System.out.println(“tr2=” + tr2);
    tamino.commit(true);
    tamino.endSession();
    :confused:


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs


  • 2.  RE: Simple update

    Posted Fri November 09, 2001 10:51 AM

    Can we have some idea what the structure of the schema is?

    Does the query find a document?

    Does System.out.println show anything?


    #API-Management
    #webMethods-Tamino-XML-Server-APIs
    #webMethods


  • 3.  RE: Simple update

    Posted Fri November 16, 2001 02:33 AM
    quote:
    Can we have some idea what the structure of the schema is?

    The document is list of Purchase Orders(PO), with each PO having multiple lineitems. So the structure looks like -









    quote:

    Does the query find a document?
    Does System.out.println show anything?

    Yes, the query finds the relevant node. I can also see that update happens in memory on that node. However, when I use tamino.update(element), nothing happens.

    I also tried different variation of update API with no luck.

    Appreciate if you have any feedback.

    --naren


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs


  • 4.  RE: Simple update

    Posted Fri November 16, 2001 03:21 AM

    This something that is unclear to me.

    I have document that contains list of Purchase Orders (PO), the structure is as shown above. Now I have create a collection and I have added only one document (polist.xml). This XML document contains 300 PO’s.

    When I do a query using TII (Tamino Interactive Interface), the result always shows all the elements as having “ino:id=1”.

    For instance, if the query is - /polist/po - all po’s have ino:id of 1. If the query is /polist/po/customer - then all customers have ino:id=1.

    I thought each node has unique “ino:id”. Anybody willing to throw some light ??

    –naren


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management


  • 5.  RE: Simple update

    Posted Fri November 16, 2001 09:51 AM

    All now becomes clear…

    Bill Leeney points out the following about your Java code. The query

    String tq = “/polist/po[5]/lineitems/lineitem[1]/item”;

    returns a small subset of the whole document, not the whole document itself. As Tamino update takes place on a ‘whole document’ level i.e. you can’t just specify one node/element in an update, there is no surprise that when you try to use the result of this query in an update it doesn’t work. You need to get the whole document, change the elements you wish to change and write the whole document back again with update.

    As for your second problen, inoids, any defined schema in Tamino will store multiple documents of that schema. Each of these documents has a unique inoid, not the elements/nodes within the document.
    You state " I have added only one document" so therefore it is no surprise that query results only show inoid 1.

    If your schema was





    You could present each po to tamino separately. Each stored po would then have it’s own unique ino:id.


    #webMethods
    #webMethods-Tamino-XML-Server-APIs
    #API-Management


  • 6.  RE: Simple update

    Posted Fri November 16, 2001 11:34 PM

    Thank you guys.

    So, I HAVE to get the “whole document” to small little update somewhere in my subtree. I missed this in documentation.

    –naren


    #webMethods
    #API-Management
    #webMethods-Tamino-XML-Server-APIs