1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
<?php
error_reporting(E_ERROR | E_WARNING | E_PARSE);
// Pull in the NuSOAP code
require_once("nusoap/lib/nusoap.php");
$namespace = "http://localhost/webservice/new.php";
$server = new soap_server();// Create the server instance
$server->configureWSDL("getListSchedule");// configure our WSDL
$server->configureWSDL('schedulewsdl', 'urn:schedulewsdl');
$server->wsdl->schemaTargetNamespace = $namespace;// set our namespace
$server->methodreturnisliteralxml = TRUE;
$server->soap_defencoding = 'utf-8'; // Character encoding
$server->wsdl->addComplexType(
'schedule',
'complexType',
'struct',
'all',
'',
array(
'id' => array('name' => 'id', 'type' => 'xsd:int'),
'idBox' => array('name' => 'idBox', 'type' => 'xsd:string'),
'network_id' => array('name' => 'network_id', 'type' => 'xsd:int'),
'event_id' => array('name' => 'event_id', 'type' => 'xsd:int'),
'serie_id' => array('name' => 'serie_id', 'type' => 'xsd:string'),
'TS_id' => array('name' => 'TS_id', 'type' => 'xsd:int'),
'serv_id' => array('name' => 'serv_id', 'type' => 'xsd:int'),
'title' => array('name' => 'title', 'type' => 'xsd:string'),
'channel_name' => array('name' => 'channel_name', 'type' => 'xsd:string'),
'startTime' => array('name' => 'startTime', 'type' => 'xsd:int'),
'stopTime' => array('name' => 'stopTime', 'type' => 'xsd:int')
)
);
$server->wsdl->addComplexType(
'ScheduleArray', // Name
'complexType', // Type Class
'array', // PHP Type
'', // Compositor
'SOAP-ENC:Array', // Restricted Base
array(),
array(
array('ref' => 'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:schedule[]')
),
'tns:schedule'
);
/*----------------------Register get all list schedule function---------------------------*/
$server->register('getListSchedule',
array('idBox'=>'xsd:string'), //paramètre en entré
array('schedule' => 'tns:scheduleArray')
//array('return'=>'xsd:string')
);
/*---------------------------Body get all list schedule function--------------------------*/
function getListSchedule($idBox) {
$connect = mysqli_connect("localhost","root","","RecordScheduleDB");
$sql = "SELECT * FROM schedule WHERE idBox='$idBox'";
$query=mysqli_query($connect,$sql);
while($result = mysqli_fetch_array($query)){
$schedule = array(
'id' => $result['id'],
'TS_id' => $result['TS_id'],
'network_id' => $result['network_id'],
'serv_id' => $result['serv_id'],
'serie_id' => $result['serie_id'],
'event_id' => $result['event_id'],
'title' => $result['title'],
'channel_name' => $result['channel_name'],
'startTime' => $result['startTime'],
'stopTome' => $result['stopTime'],'type' => 'tns:scheduleArray');
$ScheduleArray[]=$schedule;
}
return $ScheduleArray;
}
/*------------------------------------------------------------------------------------------*/
$POST_DATA = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : '';
$server->service($POST_DATA);// pass our posted data (or nothing) to the soap service
exit();
?> |
Partager