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.  PHP API, insert

    Posted Wed August 27, 2003 02:43 PM

    Hello!

    Software:


    • Windows 2000 Professional + SP3
    • Tamino 4.1.4.1
    • Apache Web Server 1.3.22
    • PHP 4.3.2


    I just downloaded new PHP API for Tamino:
    http://developer.softwareag.com/tamino/download.htm#phpapi

    Using these two scrips:
    - TaminoAPI.php,
    - TaminoHelperFunctions.php
    I can execute query to Tamino. It is simple. :)Example script example01.php works good.

    Unfortunately, I cannot insert new documents into databases using TaminoAPI.php :frowning:

    So, how can I add new record? For sample code, I will be very grateful.

    In advance, thanks a lot!

    best regards,
    Dariusz Baumann


    #webMethods
    #Tamino
    #API-Management


  • 2.  RE: PHP API, insert

    Posted Wed August 27, 2003 02:53 PM

    Hi Dariusz,

    Here’s an example:-

      
    // code fragment to insert a document
    
    $database = "mydb";
    $tamino = &new TaminoAPI("localhost", "80", $database, "", "");
    
    $xml = "<?xml version='1.0'?>";
    $xml .= "<somedocument>xxxxx</somedocument>";
    
    if ($tamino->process($xml)) {
    echo "document inserted ok";
    } else {
    echo "General failure inserting document";
    thfPrintError($tamino);
    }
    



    Hope this helps.

    Stuart Fyffe-Collins
    Software AG (UK) Ltd.


    #Tamino
    #webMethods
    #API-Management


  • 3.  RE: PHP API, insert

    Posted Wed August 27, 2003 04:45 PM

    Hello Stuart!

    First of all, thanks a lot for a very quick answer!

    Inserting to Tamino new documents now works pretty good! :slight_smile:

    Now, I need to modify data in my database. I just wrote a sample code which returning all value nodes:

    Here is example sample data:



    Franz
    M


    #Tamino
    #webMethods
    #API-Management


  • 4.  RE: PHP API, insert

    Posted Thu August 28, 2003 02:09 PM

    Hi Dariusz,

    to modify only single elements or attributes of a document, you will be much easier off if you use the XQuery update operations instead of loading a whole document from Tamino, changing it and storing it back into Tamino. The PHP API provides an xquery()-method.

    You could do something like the following:

    $xquery  = "update for \$a in input()/myDoctype ".
    "where \$a/myElement=\"myValue\" ".
    "do replace \$a/myElement ".
    "with <myElement>myNewValue</myElement>";
    $tamino->xquery($xquery);



    regards,
    Heiko


    #Tamino
    #API-Management
    #webMethods