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.  EXAMPLE01.php

    Posted Sun January 16, 2005 11:30 AM

    One last question please…
    The DOMXML is fine now but when I try to compile example01.php it gives HTTP ERROR 404!
    I unzipped the taminoapi.php into the htdocs of apache and then called the file example01.php.
    Heres the code
    [B]
    <?php

    // This script demonstrates the general functionality of the TaminoAPI class

    header("Content-Type: text/html; charset=UTF-8");
    echo "\n\n";

    require_once("TaminoAPI.php");
    require_once("TaminoHelperFunctions.php");


    // create TaminoAPI object
    $tamino = &new TaminoAPI(
    "host", // name of the machine that the web server runs on
    "80", // port the web server listens to for Tamino connections
    "mydb", // name of the Tamino database
    "", // username used for connections to Tamino
    "" // password used for connections to Tamino
    );

    $tamino->setHttpRequestMethod("POST");

    // define a new collection
    $sSchema = file_get_contents("schema.myAddresses.utf-8.tsd");
    if (!($tamino->define($sSchema)))
    thfPrintError($tamino);
    else
    echo "Schema defined successfully\n";
    echo "


    \n";

    // store data in Tamino with two different encoding types
    $tamino->setCollection("myAddresses");
    $sData = file_get_contents("data.myAddresses.windows-1252.xml");
    $tamino->setEncoding("windows-1252");
    if (!($tamino->process($sData)))
    thfPrintError($tamino);
    else
    echo "Data with encoding \"windows-1252\" loaded successfully\n";
    echo "
    \n";
    $sData = file_get_contents("data.myAddresses.utf-8.xml");
    $tamino->setEncoding("UTF-8");
    if (!($tamino->process($sData)))
    thfPrintError($tamino);
    else
    echo "Data with encoding \"UTF-8\" loaded successfully\n";
    echo "
    \n";

    // delete a document
    if (!($tamino->delete("/person[@ino:id=1]")))
    thfPrintError($tamino);
    else
    echo "Data deleted successfully\n";
    echo "
    \n";

    // retrieve data via XQL (X-Query)
    if (!($tamino->query("/person/name[firstName=\"Franz\"]")))
    thfPrintError($tamino);
    else
    {
    $domnodeResultElement = $tamino->getResultDomNode();
    if ($domnodeResultElement) {
    $domnodeCurrent = $domnodeResultElement->first_child();
    while ($domnodeCurrent != NULL) {
    if ($domnodeCurrent->node_type() == XML_ELEMENT_NODE) {
    if ($domnodeCurrent->node_name() == "name") {
    $nodelistAttributes = $domnodeCurrent->attributes();
    $numAttributes = count($nodelistAttributes);
    for ($i = 0; $i < $numAttributes; $i++) {
    if ($nodelistAttributes[$i]->name() == "id") {
    $inoId = intVal($nodelistAttributes[$i]->value());
    }
    }

    $domnodeCurrent2 = $domnodeCurrent->first_child();
    while ($domnodeCurrent2 != NULL) {
    if ($domnodeCurrent2->node_type() == XML_ELEMENT_NODE) {
    if ($domnodeCurrent2->node_name() == "lastName")
    $lastName = $domnodeCurrent2->get_content();
    }
    $domnodeCurrent2 = $domnodeCurrent2->next_sibling();
    }
    }
    }
    $domnodeCurrent = $domnodeCurrent->next_sibling();
    }
    }
    echo "X-Query executed successfully - found value: lastName=\"".$lastName."\" and ino:id=\"".$inoId."\"\n";
    }
    echo "
    \n";

    // retrieve data via plain URL addressing
    if (!($tamino->plainUrlAddressing("person/@".$inoId)))
    thfPrintError($tamino);
    else {
    echo "Plain URL addressing executed successfully for ino:id=\"".$inoId."\":\n";
    $tamino->printResultBody();
    }
    echo "
    \n";

    // undefine collection
    if (!($tamino->undefine("myAddresses")))
    thfPrintError($tamino);
    else
    echo "Schema undefined successfully\n";
    echo "
    \n";

    echo "\n\n";

    ?> [B]

    I created the database in the SMH and started it. The port is 80 I guess! Should there be a path to the database instead of just ‘mydb’ ? Wheres my database on my harddrive? In other native database(xindice),I was able to see my db but I cant find any ‘mydb’ folder on my harddrive. How can I eradicate the ERROR 404?
    Thanks a lot
    Kay

    Arsenal are the best!


    #API-Management
    #Tamino
    #webMethods


  • 2.  RE: EXAMPLE01.php

    Posted Mon January 17, 2005 09:47 AM

    The test page is attempting to communicate with your Tamino database via http and is getting a 404 (not found) reply.
    To fix this (assuming your Tamino database is running on the same machine as your web server) change “host” to “localhost” and change “mydb” to the name of your database.

    It may help to check that your Tamino database is really running first. Start a browser and go to url:
    http://localhost/tamino/?_diagnose=ping
    and you should get an xml response.

    HTH
    and you


    #webMethods
    #Tamino
    #API-Management


  • 3.  RE: EXAMPLE01.php

    Posted Mon January 17, 2005 11:39 PM

    Hi Bill,
    You have done it once again.
    I appreciate it.
    Thanks a lot.
    Kay

    Arsenal are the best!


    #Tamino
    #API-Management
    #webMethods