mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
SOAP Schnittstelle für Kartenverlängerungsautomat
This commit is contained in:
Executable
+80
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2012 FH Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
|
||||
require_once('../config/cis.config.inc.php');
|
||||
require_once('../include/konto.class.php');
|
||||
require_once('../include/betriebsmittelperson.class.php');
|
||||
require_once('../include/studiensemester.class.php');
|
||||
require_once('../include/benutzer.class.php');
|
||||
require_once('../include/webservicelog.class.php');
|
||||
|
||||
ini_set("soap.wsdl_cache_enabled", "0");
|
||||
|
||||
$SOAPServer = new SoapServer(APP_ROOT.'soap/kartenverlaengerung.wsdl.php?'.microtime());
|
||||
$SOAPServer->addFunction('getNumber');
|
||||
$SOAPServer->handle();
|
||||
|
||||
function getNumber($cardNr)
|
||||
{
|
||||
// Fehler wenn keine Kartennummer übergeben wurde
|
||||
if($cardNr == '')
|
||||
{
|
||||
$objArray = array('datum'=>'', 'errorMessage'=>'keine gültige Nummer übergeben.');
|
||||
return $objArray;
|
||||
}
|
||||
|
||||
// Karte ist noch nicht ausgegeben
|
||||
$cardUser = new betriebsmittelperson();
|
||||
if(!$cardUser->getKartenzuordnung($cardNr))
|
||||
{
|
||||
$objArray = array('datum'=>'', 'errorMessage'=>'Konnte Karte keiner Person zuweisen. Bitte wenden Sie sich an den Service Desk.');
|
||||
return $objArray;
|
||||
}
|
||||
|
||||
// User zur Karte konnte nicht geladen werden
|
||||
$cardPerson = new benutzer();
|
||||
if(!$cardPerson->load($cardUser->uid))
|
||||
{
|
||||
$objArray = array('datum'=>'', 'errorMessage'=>'Die Person kann nicht geladen werden. Bitte wenden Sie sich an den Service Desk.');
|
||||
return $objArray;
|
||||
}
|
||||
|
||||
// aktuelles Semester konnte nicht geladen werden
|
||||
// lädt das aktuelle semester und nach 60 Tagen nach Anfang des Semesters das nächste
|
||||
$studSemester = new studiensemester();
|
||||
if(!$aktSemester= $studSemester->getNextOrAktSemester())
|
||||
{
|
||||
$objArray = array('datum'=>'', 'errorMessage'=>'Konnte Semester nicht laden. Bitte wenden Sie sich an den Service Desk.');
|
||||
return $objArray;
|
||||
}
|
||||
|
||||
$konto = new konto();
|
||||
if(!$konto->checkStudienbeitrag($cardPerson->uid, $aktSemester))
|
||||
{
|
||||
$objArray = array('datum'=>'', 'errorMessage'=>'Studienbeitrag noch nicht gezahlt.');
|
||||
return $objArray;
|
||||
}
|
||||
|
||||
$objArray = array('datum'=>'bezahlt', 'errorMessage'=>'');
|
||||
return $objArray;
|
||||
|
||||
}
|
||||
?>
|
||||
Executable
+61
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2012 FH Technikum-Wien
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as
|
||||
* published by the Free Software Foundation; either version 2 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* Authors: Karl Burkhart <burkhart@technikum-wien.at>
|
||||
*/
|
||||
require_once('../config/cis.config.inc.php');
|
||||
|
||||
if(isset($_REQUEST['sub_card']))
|
||||
{
|
||||
$cardNumber = $_REQUEST['cardNumber'];
|
||||
$client = new SoapClient(APP_ROOT."soap/kartenverlaengerung.wsdl.php?".microtime(true));
|
||||
|
||||
try
|
||||
{
|
||||
$response = $client->getNumber($cardNr = $cardNumber);
|
||||
|
||||
var_dump($response);
|
||||
}
|
||||
catch(SoapFault $fault)
|
||||
{
|
||||
echo "SOAP Fault: (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Webservice Kartenverlaengerung</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>Webservice Kartenverlängerung</h1>
|
||||
<form action ="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" name="card">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Kartennummer:</td>
|
||||
<td><input type="text" name="cardNumber" size="35"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" name="sub_card" value="Daten absenden"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+49
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require_once('../config/cis.config.inc.php');
|
||||
header("Content-type: text/plain");
|
||||
echo "<?xml version='1.0' encoding='utf-8' ?>";
|
||||
?>
|
||||
|
||||
<wsdl:definitions name="Kartenverlaengerung"
|
||||
targetNamespace="http://www.technikum-wien.at/soap/"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:tns="http://www.technikum-wien.at/soap/"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:xsd1="http://localhost/soap/projekt.xsd"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
|
||||
<wsdl:message name="getNumberRequest">
|
||||
<wsdl:part name="cardNr" type="xsd:string" minOccurs="0"></wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="getNumberResponse">
|
||||
<wsdl:part name="datum" type="xsd:string"></wsdl:part>
|
||||
<wsdl:part name="errorMessage" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="ConfigPortType" >
|
||||
<wsdl:operation name="getNumber">
|
||||
<wsdl:input message="tns:getNumberRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:getNumberResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="ConfigBinding" type="tns:ConfigPortType">
|
||||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
|
||||
<wsdl:operation name="getNumber">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/getNumber";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
|
||||
<wsdl:service name="Kartenverlaengerung">
|
||||
<wsdl:port name="ConfigWebservicePort" binding="tns:ConfigBinding">
|
||||
<soap:address location="<?php echo APP_ROOT."soap/kartenverlaengerung.soap.php";?>"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
||||
Reference in New Issue
Block a user