* Shows a usage of the SOAP queries 
 *
 * @copyright   Copyright (C) 2010-2012 Combodo SARL
 * @license     http://opensource.org/licenses/AGPL-3.0
 */
require_once 'itopsoaptypes.class.inc.php';
$sItopRoot = 'http' . (utils::IsConnectionSecure() ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . dirname($_SERVER['SCRIPT_NAME']) . '/..';
$sWsdlUri = $sItopRoot . '/webservices/itop.wsdl.php';
//$sWsdlUri .= '?service_category=';
$aSOAPMapping = SOAPMapping::GetMapping();
ini_set("soap.wsdl_cache_enabled", "0");
$oSoapClient = new SoapClient($sWsdlUri, array('trace' => 1, 'classmap' => $aSOAPMapping));
try {
    // The most simple service, returning a string
    //
    $sServerVersion = $oSoapClient->GetVersion();
    echo "<p>GetVersion() returned <em>{$sServerVersion}</em></p>";
    // More complex ones, returning a SOAPResult structure
    // (run the page to know more about the returned data)
    //
    $oRes = $oSoapClient->CreateIncidentTicket('admin', 'admin', 'Email server down', 'HW found shutdown', null, new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Management'))), new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Troubleshooting'))), '', new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW support'))), array(new SOAPLinkCreationSpec('Device', array(new SOAPSearchCondition('name', 'switch01')), array()), new SOAPLinkCreationSpec('Server', array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), array())), '1', '1');
    echo "<p>CreateIncidentTicket() returned:\n";
    echo "<pre>\n";
    print_r($oRes);
    echo "</pre>\n";
    echo "</p>\n";
    $oRes = $oSoapClient->SearchObjects('admin', 'admin', 'SELECT URP_Profiles');
    echo "<p>SearchObjects() returned:\n";
    if ($oRes->status) {
        $aResults = $oRes->result;
        echo "<table>\n";