} // INSERT INTO NEW SUPERVISOR REPORT LOG TOO $entry = 'Executive Notification - ' . $type . ' - ' . $_POST['parentTicket'] . ' - ' . $_POST['subject']; if ($_POST['update'] != "") { $entry .= "\n\n" . nl2br($_POST['update']); } // INCLUDE IT AS PART OF THE SUPEVISOR'S REPORT-SO-FAR $_SESSION['supReport'][date('Y-m-d G:i:s:u')] = array(date('D. @ G:i:s'), $netID, $entry); // INCLUDE UPDATES TO THE TICKET ITSELF try { $soapurl = getenv("SERVICENOWSTAGEURL") . "/incident.do?WSDL"; if ($env == 2) { $soapurl = getenv("SERVICENOWURL") . "/incident.do?WSDL"; } $incidentClient = new SoapClient($soapurl, array('trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_MEMORY, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'login' => $netID, 'password' => $passy)); $updateResponse = $incidentClient->update(array('sys_id' => $sysId, 'short_description' => $_POST['subject'], 'u_work_log' => "(Internal Comment)" . html2text($ticketEntry))); if (isset($updateResponse->sys_id)) { echo "<h2> Ticket's work-log has been updated successfully. </h2>"; } else { echo "<h2> Updating the work-log for the ticket failed. Please attempt to do so manually. </h2>"; } } catch (Exception $E) { if ($env == 2) { $errorInfo = ''; } else { $errorInfo = "ERROR " . print_r($E, true); } echo "<h2> Unable to connect to service-now to insert your update to the work-log. Please attempt to do so manually. <br><br>{$errorInfo}</h2>"; } $emailBody = formEmail($_POST); $subject = getEmailType($type) . $_POST['subject'];
<?php ini_set("soap.wsdl_cache_enabled", 0); $c = new SoapClient(dirname(__FILE__) . "/bug40609.wsdl", array('trace' => 1, 'exceptions' => 0)); $c->update(array('symbol' => new SoapVar("<symbol>MSFT</symbol>", XSD_ANYXML), 'price' => new SoapVar("<price>1000</price>", XSD_ANYXML))); echo $c->__getLastRequest(); echo "ok\n";
<?php // Llamar al método como si fuera del cliente $cliente = new SoapClient(null, array('location' => 'http://localhost/users/ws/service.php', 'uri' => 'urn:webservices')); if ($_POST["option"] == "insert") { echo $cliente->insert($_POST); } else { if ($_POST["option"] == "list") { echo $cliente->listUser(); } else { if ($_POST["option"] == "delete") { echo $cliente->delete($_POST); } else { if ($_POST["option"] == "select") { echo $cliente->select($_POST); } else { if ($_POST["option"] == "update") { echo $cliente->update($_POST); } } } } }
$req = array(); $req['sys_id'] = $_REQUEST['sys_id']; $req['short_description'] = $_REQUEST['short_description']; $req['u_completion_rating'] = $_REQUEST['rating']; if (isset($_REQUEST['start'])) { $req['work_start'] = $_REQUEST['start']; } if (isset($_REQUEST['end'])) { $req['work_end'] = $_REQUEST['end']; } if (isset($_REQUEST['comments'])) { $req['u_task_work_log'] = $_REQUEST['comments']; } if (isset($_REQUEST['down_time'])) { $req['u_actual_down_time'] = $_REQUEST['down_time']; } // Cannot currently change the state directly if (isset($_REQUEST['state'])) { $req['state'] = $_REQUEST['state']; } $url = getenv("SERVICENOWSTAGEURL") . "/change_request.do?WSDL"; if ($env == 2) { $url = getenv("SERVICENOWURL") . "/change_request.do?WSDL"; } $ServiceNowClient = new SoapClient($url, array('trace' => 1, 'exceptions' => true, 'cache_wsdl' => WSDL_CACHE_MEMORY, 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, 'login' => $netID, 'password' => $password)); $result = $ServiceNowClient->update($req); if (isset($result->sys_id)) { echo json_encode(true); } else { echo json_encode(false); }