IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

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.  Taminoclient.Delete() Problem

    Posted Tue November 06, 2001 05:39 PM

    We have a Schema structure

    Catalog(Header,Schema?,Data?)
    Data(Product*)

    The schema is present in Tamino Collection and stored with Catalog information.

    Our requirement states that a user can delete one or more products from the “Data” section of
    “Catalog”

    (i.e) we want to delete a particular node from the document.

    Consider the following is a catlog that exists in Tamino DB,



    Buyer1














    Buyer2







    Now if the user deletes the Product “3” and Product “4” for Catalog ID “Buyer1”.
    The catalog in Tamino DB should become



    Buyer1












    Buyer2







    We are using Tamino API’s to deal with deletion (TaminoClient delete(element)). But we were not
    able to delete a particular node from the retrieved query.


    Our Code snippet is as follws

    public void deleteProduct(String productNumber)
    {
    try {
    TaminoClient tamino=new TaminoClient(getTaminoClientURL());
    tamino.startSession();
    TaminoResult tr = tamino.query(getQuery());
    Element element = tr.getNextElement();
    NodeList nl = element.getElementsByTagName(“Product”);
    for (int i = 0; i < nl.getLength(); i++)
    {
    Node currItem = nl.item(i);
    Element e = (Element)currItem;
    if (productNumber.equals((String)e.getElementsByTagName(“ManuPartNumber”).item(0).getFirstChild().getNodeValue()))
    {
    System.out.println(“Deleting”);
    tamino.delete(e);
    break;
    }
    }
    tamino.commit(false);
    tamino.endSession();
    }
    catch(TaminoError er) {
    System.out.println(er.toString());
    }
    catch(Exception e)
    { System.out.println(e.toString());
    }
    }


    where,
    getTaminoClientURL() - “http://rnpmsxml01/tamino/XRVDB10/Catalog
    getQuery() - “/Catalog[Header/CatalogID~=‘Buyer1’]”

    We have made sure that the “for” loop is entered successfully and the Message “Deleting” is
    displayed. However, the tamino.delete(e) fails. It says “No Matching Record”. Do you think we are missing something.


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


  • 2.  RE: Taminoclient.Delete() Problem

    Posted Tue November 06, 2001 06:25 PM

    Error Message = “No matching DOCUMENT found”
    Error Code = 8330.

    Thanks


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


  • 3.  RE: Taminoclient.Delete() Problem

    Posted Wed November 07, 2001 05:09 AM

    If your record really exits then try
    taminoresult(object of TaminoResult)= taminoClient(object of TaminoClient).delete(element,, );


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


  • 4.  RE: Taminoclient.Delete() Problem

    Posted Wed November 07, 2001 05:10 AM

    If your record really exits then try
    taminoresult(object of TaminoResult)= taminoClient(object of TaminoClient).delete(element,, );
    :wink:


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


  • 5.  RE: Taminoclient.Delete() Problem

    Posted Sat April 13, 2002 04:12 PM

    Kindly give an example for the above structure
    What I have specify for element and doctype

    K. S. Kini


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


  • 6.  RE: Taminoclient.Delete() Problem

    Posted Mon April 15, 2002 09:47 AM

    from your snippet

    TaminoResult tr = tamino.query(getQuery());
    Element element = tr.getNextElement();
    NodeList nl = element.getElementsByTagName(“Product”);

    I infer that the element “Product” is not a document element.

    If so .delete can’t delete it. .delete can only delete complete documents and it recognizes the
    document by the ino:id


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


  • 7.  RE: Taminoclient.Delete() Problem

    Posted Mon April 15, 2002 01:09 PM

    Sorry - didn’t complete my message. I wasn’t try to be unhelpful

    In your program you read the complete Catalog instance in to a DOM instance. Locate the product elements you want to delete as you are doing now
    but remove the product element from the DOM instance using the DOM removeChild method.
    Node that DOM nodeLists are (usually) “live” so that when you remove a node from the list the
    length of the node list changes and the nodes following the node your have removed will shift up to replace the gap - so use a while loop and increment the “i” counter only for nodes you DON’T delete.
    When you are done write the Catalog instance back using the TaminoClient process method.

    In the next major release of Tamino you should be able to delete subnodes in the way you are attempting - It is also possible to do this in the present Tamino version using the NodeLevelUpdate DLL but this only works if your web server is IIS


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