diff --git a/pages/testlist.inc.php b/pages/testlist.inc.php index b1b47dd1c..ad0cb5106 100644 --- a/pages/testlist.inc.php +++ b/pages/testlist.inc.php @@ -1274,8 +1274,8 @@ class TestItopWebServices extends TestWebServices $aWebServices = array( array( 'verb' => 'GetVersion', - 'expected result' => '0.8', - 'explain result' => 'n/a', + 'expected result' => WebServices::GetVersion(), + 'explain result' => 'no comment!', 'args' => array(), ), array( @@ -1316,7 +1316,7 @@ $aWebServices = array( ), array( 'verb' => 'CreateIncidentTicket', - 'expected result' => false, + 'expected result' => true, 'explain result' => 'caller not specified', 'args' => array( 'admin', /* sLogin */ @@ -1435,7 +1435,7 @@ $aWebServices = array( ), array( 'verb' => 'CreateIncidentTicket', - 'expected result' => false, + 'expected result' => true, 'explain result' => 'caller unknown', 'args' => array( 'admin', /* sLogin */ @@ -1590,6 +1590,10 @@ class TestSoap extends TestSoapWebService } if ($res != $aWebService['expected result']) { + echo "Expecting:
\n"; + var_dump($aWebService['expected result']); + echo "Obtained:
\n"; + var_dump($res); throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'"); } } @@ -1616,6 +1620,23 @@ class TestWebServicesDirect extends TestBizModel echo "
\n";
 			print_r($oRes);
 			echo "
\n"; + + if ($oRes instanceof SOAPResult) + { + $res = $oRes->status; + } + else + { + $res = $oRes; + } + if ($res != $aWebService['expected result']) + { + echo "Expecting:
\n"; + var_dump($aWebService['expected result']); + echo "Obtained:
\n"; + var_dump($res); + throw new UnitTestException("Expecting result '{$aWebService['expected result']}', but got '$res'"); + } } return true; } diff --git a/webservices/itopsoap.examples.php b/webservices/itopsoap.examples.php index 213634844..982aec523 100644 --- a/webservices/itopsoap.examples.php +++ b/webservices/itopsoap.examples.php @@ -56,7 +56,7 @@ try 'HW found shutdown', /* description */ null, /* caller */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* customer */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Mgmt'))), /* service */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Management'))), /* service */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Troubleshooting'))), /* service subcategory */ '', /* product */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW support'))), /* workgroup */ diff --git a/webservices/webservices.class.inc.php b/webservices/webservices.class.inc.php index aa853dc5d..b9d07efd3 100644 --- a/webservices/webservices.class.inc.php +++ b/webservices/webservices.class.inc.php @@ -498,8 +498,9 @@ class WebServices } - static protected function SoapStructToExternalKeySearch(SoapExternalKeySearch $oExternalKeySearch) + static protected function SoapStructToExternalKeySearch($oExternalKeySearch) { + if (is_null($oExternalKeySearch)) return null; if ($oExternalKeySearch->IsVoid()) return null; $aRes = array(); @@ -538,9 +539,19 @@ class WebServices * * @return WebServiceResult */ - public function GetVersion() + static public function GetVersion() { - return "0.8"; + if (ITOP_REVISION == '$WCREV$') + { + $sVersionString = ITOP_VERSION.' [dev]'; + } + else + { + // This is a build made from SVN, let display the full information + $sVersionString = ITOP_VERSION."-".ITOP_REVISION." ".ITOP_BUILD_DATE; + } + + return $sVersionString; } public function CreateIncidentTicket($sLogin, $sPassword, $sTitle, $sDescription, $oCallerDesc, $oCustomerDesc, $oServiceDesc, $oServiceSubcategoryDesc, $sProduct, $oWorkgroupDesc, $aSOAPImpactedCIs, $sImpact, $sUrgency)