diff --git a/pages/testlist.inc.php b/pages/testlist.inc.php index 82e31b7c6f..d326fc4a92 100644 --- a/pages/testlist.inc.php +++ b/pages/testlist.inc.php @@ -1285,31 +1285,33 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Server', /* sType */ 'desc of ticket', /* sDescription */ 'initial situation blah blah blah', /* sInitialSituation */ - 'very grave', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( new SOAPLinkCreationSpec( - 'logInfra', + 'InfrastructureCI', array(new SOAPSearchCondition('id', 108)), array(new SOAPAttributeValue('impacting', 'very critical')) ), new SOAPLinkCreationSpec( - 'bizDevice', + 'NetworkDevice', array(new SOAPSearchCondition('name', 'Router03')), array(new SOAPAttributeValue('impact', 'who cares')) ), new SOAPLinkCreationSpec( - 'bizDevice', + 'Device', array(new SOAPSearchCondition('name', 'thisone')), array(new SOAPAttributeValue('impact', 'our lives')) ), ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1319,16 +1321,23 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Desktop', /* sType */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ - 'The agent could not do his job', /* sImpact */ null, /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( - ), /* aImpact */ - 'low' /* sSeverity */ + new SOAPLinkCreationSpec( + 'InfrastructureCI', + array(new SOAPSearchCondition('id', 1)), + array() + ), /* aImpact */ + ), + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1338,12 +1347,13 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Desktop', /* sType */ 'PC burning', /* sDescription */ 'The power supply suddenly started to warm up', /* sInitialSituation */ - 'The agent could not do his job', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( new SOAPLinkCreationSpec( @@ -1352,7 +1362,8 @@ $aWebServices = array( array(new SOAPAttributeValue('impact', 'very critical')) ), ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1362,16 +1373,18 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Network', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1381,15 +1394,17 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Network', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ null, /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1399,16 +1414,18 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'Network', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1000))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1418,16 +1435,18 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'admin', /* sPassword */ - 'my type', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - 'my severity' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1437,16 +1456,18 @@ $aWebServices = array( 'args' => array( 'admin', /* sLogin */ 'xxxxx', /* sPassword */ - 'Network', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), array( @@ -1456,16 +1477,18 @@ $aWebServices = array( 'args' => array( 'xxxxx', /* sLogin */ 'yyyyy', /* sPassword */ - 'Network', /* sType */ 'Houston not reachable', /* sDescription */ 'Tried to join the shuttle', /* sInitialSituation */ - 'Could not talk to my wife', /* sImpact */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aCallerDesc */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 2))), /* aCustomerDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 4))), /* aServiceDesc */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* aServiceSubcategoryDesc */ + 'sub product of the service', /* sProduct */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'FLS Desktop'))), /* aWorkgroupDesc */ array( ), /* aImpact */ - 'low' /* sSeverity */ + '1', /* sImpact */ + '1', /* sUrgency */ ), ), ); diff --git a/webservices/itop.wsdl.tpl b/webservices/itop.wsdl.tpl index c3e4289e36..f4a2b4051f 100644 --- a/webservices/itop.wsdl.tpl +++ b/webservices/itop.wsdl.tpl @@ -146,15 +146,17 @@ - + - - + + + - + + diff --git a/webservices/itopsoap.examples.php b/webservices/itopsoap.examples.php index 755d05e926..845bccc041 100644 --- a/webservices/itopsoap.examples.php +++ b/webservices/itopsoap.examples.php @@ -52,26 +52,28 @@ try ( 'admin', /* login */ 'admin', /* password */ - 'Server', /* type */ - 'Email server down', /* description */ - 'HW found shutdown', /* initial situation */ - 'Email not working', /* impact */ + 'Email server down', /* title */ + 'HW found shutdown', /* description */ null, /* caller */ new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Demo'))), /* customer */ - new SOAPExternalKeySearch(array(new SOAPSearchCondition('id', 1))), /* workgroup */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW Mgmt'))), /* service */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'Troubleshooting'))), /* service subcategory */ + '', /* product */ + new SOAPExternalKeySearch(array(new SOAPSearchCondition('name', 'NW support'))), /* workgroup */ array( new SOAPLinkCreationSpec( - 'bizDevice', - array(new SOAPSearchCondition('name', 'Router03')), - array(new SOAPAttributeValue('impact', 'root cause')) + 'Device', + array(new SOAPSearchCondition('name', 'switch01')), + array() ), new SOAPLinkCreationSpec( - 'bizServer', - array(new SOAPSearchCondition('name', 'Server01')), - array(new SOAPAttributeValue('impact', '')) + 'Server', + array(new SOAPSearchCondition('name', 'dbserver1.demo.com')), + array() ), - ), /* impact */ - 'high' /* severity */ + ), /* impacted cis */ + '1', /* impact */ + '1', /* urgency */ ); echo "

CreateIncidentTicket() returned:\n"; diff --git a/webservices/webservices.class.inc.php b/webservices/webservices.class.inc.php index dc671f8856..47307fbd37 100644 --- a/webservices/webservices.class.inc.php +++ b/webservices/webservices.class.inc.php @@ -543,7 +543,7 @@ class WebServices return "0.8"; } - public function CreateIncidentTicket($sLogin, $sPassword, $sType, $sDescription, $sInitialSituation, $sImpact, $oCallerDesc, $oCustomerDesc, $oWorkgroupDesc, $aSOAPImpactedCIs, $sSeverity) + public function CreateIncidentTicket($sLogin, $sPassword, $sTitle, $sDescription, $oCallerDesc, $oCustomerDesc, $oServiceDesc, $oServiceSubcategoryDesc, $sProduct, $oWorkgroupDesc, $aSOAPImpactedCIs, $sImpact, $sUrgency) { if (!UserRights::Login($sLogin, $sPassword)) { @@ -555,6 +555,8 @@ class WebServices $aCallerDesc = self::SoapStructToExternalKeySearch($oCallerDesc); $aCustomerDesc = self::SoapStructToExternalKeySearch($oCustomerDesc); + $aServiceDesc = self::SoapStructToExternalKeySearch($oServiceDesc); + $aServiceSubcategoryDesc = self::SoapStructToExternalKeySearch($oServiceSubcategoryDesc); $aWorkgroupDesc = self::SoapStructToExternalKeySearch($oWorkgroupDesc); $aImpactedCIs = array(); foreach($aSOAPImpactedCIs as $oImpactedCIs) @@ -564,15 +566,17 @@ class WebServices $oRes = $this->_CreateIncidentTicket ( - $sType, + $sTitle, $sDescription, - $sInitialSituation, - $sImpact, $aCallerDesc, $aCustomerDesc, + $aServiceDesc, + $aServiceSubcategoryDesc, + $sProduct, $aWorkgroupDesc, $aImpactedCIs, - $sSeverity + $sImpact, + $sUrgency ); return $oRes->ToSoapStructure(); } @@ -581,17 +585,21 @@ class WebServices * Create an incident ticket from a monitoring system * Some CIs might be specified (by their name/IP) * - * @param string sDecription - * @param string sInitialSituation + * @param string sTitle + * @param string sDescription * @param array aCallerDesc * @param array aCustomerDesc + * @param array aServiceDesc + * @param array aServiceSubcategoryDesc + * @param string sProduct * @param array aWorkgroupDesc * @param array aImpactedCIs - * @param string sSeverity + * @param string sImpact + * @param string sUrgency * * @return WebServiceResult */ - protected function _CreateIncidentTicket($sType, $sDescription, $sInitialSituation, $sImpact, $aCallerDesc, $aCustomerDesc, $aWorkgroupDesc, $aImpactedCIs, $sSeverity) + protected function _CreateIncidentTicket($sTitle, $sDescription, $aCallerDesc, $aCustomerDesc, $aServiceDesc, $aServiceSubcategoryDesc, $sProduct, $aWorkgroupDesc, $aImpactedCIs, $sImpact, $sUrgency) { $oRes = new WebServiceResult(); @@ -603,26 +611,33 @@ class WebServices $oMyChange->Set("userinfo", "Administrator"); $iChangeId = $oMyChange->DBInsertNoReload(); - $oNewTicket = MetaModel::NewObject('bizIncidentTicket'); - $this->MyObjectSetScalar('type', 'type', $sType, $oNewTicket, $oRes); - $this->MyObjectSetScalar('title', 'title', $sDescription, $oNewTicket, $oRes); - $this->MyObjectSetScalar('initial_situation', 'initialsituation', $sInitialSituation, $oNewTicket, $oRes); - $this->MyObjectSetScalar('severity', 'severity', $sSeverity, $oNewTicket, $oRes); - + $oNewTicket = MetaModel::NewObject('Incident'); + $this->MyObjectSetScalar('title', 'title', $sTitle, $oNewTicket, $oRes); + $this->MyObjectSetScalar('description', 'description', $sDescription, $oNewTicket, $oRes); + $this->MyObjectSetExternalKey('org_id', 'customer', $aCustomerDesc, $oNewTicket, $oRes); $this->MyObjectSetExternalKey('caller_id', 'caller', $aCallerDesc, $oNewTicket, $oRes); - $this->MyObjectSetExternalKey('workgroup_id', 'workgroup', $aWorkgroupDesc, $oNewTicket, $oRes); - $aDevicesNotFound = $this->AddLinkedObjects('impacted_infra_manual', 'impacted_cis', 'logInfra', $aImpactedCIs, $oNewTicket, $oRes); + $this->MyObjectSetExternalKey('service_id', 'service', $aServiceDesc, $oNewTicket, $oRes); + $this->MyObjectSetExternalKey('servicesubcategory_id', 'servicesubcategory', $aServiceSubcategoryDesc, $oNewTicket, $oRes); + $this->MyObjectSetScalar('product', 'product', $sProduct, $oNewTicket, $oRes); + + $this->MyObjectSetExternalKey('workgroup_id', 'workgroup', $aWorkgroupDesc, $oNewTicket, $oRes); + + + $aDevicesNotFound = $this->AddLinkedObjects('ci_list', 'impacted_cis', 'FunctionalCI', $aImpactedCIs, $oNewTicket, $oRes); if (count($aDevicesNotFound) > 0) { - $this->MyObjectSetScalar('impact', 'n/a', $sImpact.' - Related CIs: '.implode(', ', $aDevicesNotFound), $oNewTicket, $oRes); + $this->MyObjectSetScalar('description', 'n/a', $sDescription.' - Related CIs: '.implode(', ', $aDevicesNotFound), $oNewTicket, $oRes); } else { - $this->MyObjectSetScalar('impact', 'n/a', $sImpact, $oNewTicket, $oRes); + $this->MyObjectSetScalar('description', 'n/a', $sDescription, $oNewTicket, $oRes); } + $this->MyObjectSetScalar('impact', 'impact', $sImpact, $oNewTicket, $oRes); + $this->MyObjectSetScalar('urgency', 'urgency', $sUrgency, $oNewTicket, $oRes); + $this->MyObjectInsert($oNewTicket, 'created', $oMyChange, $oRes); } catch (CoreException $e)