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.



#Automation


#Applicationintegration
#webMethods
#Integration
 View Only

Transaction handling: inserting xml and non-xml data at once

  • 1.  Transaction handling: inserting xml and non-xml data at once

    Posted 06/01/06 06:39 PM

    Hi,

    I have to use http API for Java (TaminoClient) version 3.1.2.1.
    I need to insert two documents in one transaction: an xml document and a non-xml (pdf) document. These two are on the same database, but different collections. Is it that possible? If yes, how?

    Here is a pseudo-code what I intend to do:

    try {
    TaminoClient tcXML = new TaminoClient (DATABASE_URL + "/" + XML_COLLECTION);
    tcXML.startSession();
    TaminoNonXml tcNonXML = new TaminoNonXml (DATABASE_URL + "/" + PDF_COLLECTION);
    tcNonXML.setSessionID(txNML.getSessionID()); ....//??! how to make tcNonXML use the same session as tcXML?
    
    Element element = getNextElement(); //get the next "parent" to insert
    tcXML.insert(element);
    byte[] pdf = getPDF(element);
    tcNonXML.setNonXML("pdf/"+FILENAME, "application/pdf", new ByteArrayInputStream(pdf) );//insert the associated pdf
    tcXML.commit();
    tcXML.endSession();
    } catch(Exception e) {
    tcXML.rollBack();
    tcXML.endSession();
    }
    
    protected abstract String getNextElement(); //returns the next parent to insert
    
    protected abstract byte[] getPDF(Element element);//returns pdf to insert

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