Webservice Einleitung   Verfügbare Informationen   Der Service   Testen   Datentypen   Sequenzdiagramm   Requests   Beispiel-Code (PHP5)  

Diese Dokumentation beschreibt den öffentlichen Web Service von Swiss Volley. Dieser dient der Einbindung von Liga-Relevanten Daten in eine Applikation Dritter. SOAP (Simple Object Access Protocol) ist ein schlankes XML-basiertes Protokoll für den Austausch strukturierter Informationen verteilter Applikationen über ein Web-Protokoll wie zum Beispiel HTTP. 
Zurzeit können folgende Informationen via Web Service empfangen werden:  | Ligenübersicht über alle Gruppen und Modi einer Liga
|  | Aktuelle Rangliste einer Gruppe
|  | Spielplan einer Gruppe
|  | Resultate einer Gruppe
|  | Detaillierte Informationen zu einem Spiel
|  | Detaillierte Informationen eines Teams
|  | Spielplan eines Teams |

 Die WSDL-Datei befindet sich unter folgender URL:
http://myvolley.volleyball.ch/SwissVolley.wsdl

Sie können den Webservice mit folgendem Dienst testen:
http://soapclient.com/soaptest.html

ArrayOfLeague
<complexType name="ArrayOfLeague">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd1:League[]"/>
</restriction>
</complexContent>
</complexType>
League
<complexType name="League">
<sequence>
<element name="Caption" type="string"/>
<element name="Gender" type="string"/>
<element name="league_ID" type="int"/>
</sequence>
</complexType>
ArrayOfPhase
<complexType name="ArrayOfPhase">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd1:Phase[]"/>
</restriction>
</complexContent>
</complexType>
Phase
<complexType name="Phase">
<sequence>
<element name="Caption" type="string"/>
<element name="phase_ID" type="int"/>
</sequence>
</complexType>
ArrayOfGroup
<complexType name="ArrayOfGroup">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd1:Group[]"/>
</restriction>
</complexContent>
</complexType>
GroupDetailed
<complexType name="GroupDetailed">
<sequence>
<element name="mode_ID" type="int"/>
<element name="league_ID" type="int"/>
<element name="league_cat_ID" type="int"/>
<element name="Caption" type="string"/>
<element name="LeagueCaption" type="string"/>
<element name="Gender" type="string"/>
<element name="LeagueCategoryCaption" type="string"/>
</sequence>
</complexType>
Group
<complexType name="Group">
<sequence>
<element name="Caption" type="string"/>
<element name="group_ID" type="int"/>
</sequence>
</complexType>
ArrayOfTableEntry
<complexType name="ArrayOfTableEntry">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd1:TableEntry[]"/>
</restriction>
</complexContent>
</complexType>
TableEntry
<complexType name="TableEntry">
<sequence>
<element name="Rank" type="string"/>
<element name="NumberOfGames" type="int"/>
<element name="team_ID" type="int"/>
<element name="Caption" type="string"/>
<element name="SetsWon" type="int"/>
<element name="SetsLost" type="int"/>
<element name="SetQuotient" type="float"/>
<element name="BallsWon" type="int"/>
<element name="BallsLost" type="int"/>
<element name="BallsQuotient" type="float"/>
<element name="Points" type="int"/>
</sequence>
</complexType>
ArrayOfGameEntry
<complexType name="ArrayOfGameEntry">
<complexContent>
<restriction base="SOAP-ENC:Array">
<attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd1:GameEntry[]"/>
</restriction>
</complexContent>
</complexType>
GameEntry
<complexType name="GameEntry">
<sequence>
<element name="ID_game" type="int"/>
<element name="PlayDate" type="string"/>
<element name="RoundIndex" type="int"/>
<element name="TeamHomeID" type="int"/>
<element name="TeamHomeCaption" type="string"/>
<element name="TeamAwayID" type="int"/>
<element name="TeamAwayCaption" type="string"/>
<element name="NumberOfWinsHome" type="int"/>
<element name="NumberOfWinsAway" type="int"/>
<element name="IsResultCommited" type="int"/>
<element name="UncompletedResultHome" type="int"/>
<element name="UncompletedResultAway" type="int"/>
<element name="ResultAdvicedHome" type="int"/>
<element name="ResultAdvicedAway" type="int"/>
<element name="league_cat_ID" type="int"/>
<element name="LeagueCatCaption" type="string"/>
<element name="group_ID" type="int"/>
<element name="GroupCaption" type="string"/>
<element name="mode_ID" type="int"/>
<element name="ModeCaption" type="int"/>
<element name="league_ID" type="int"/>
<element name="Gender" type="string"/>
<element name="LeagueCaption" type="string"/>
<element name="Set1PointsHome" type="int"/>
<element name="Set1PointsAway" type="int"/>
<element name="Set2PointsHome" type="int"/>
<element name="Set2PointsAway" type="int"/>
<element name="Set3PointsHome" type="int"/>
<element name="Set3PointsAway" type="int"/>
<element name="Set4PointsHome" type="int"/>
<element name="Set4PointsAway" type="int"/>
<element name="Set5PointsHome" type="int"/>
<element name="Set5PointsAway" type="int"/>
</sequence>
</complexType>
TeamDetailed
<complexType name="TeamDetailed">
<sequence>
<element name="Caption" type="string"/>
<element name="Gender" type="string"/>
<element name="club_ID" type="int"/>
<element name="ClubCaption" type="string"/>
<element name="LeagueCaption" type="string"/>
</sequence>
</complexType>
GameDetailed
<complexType name="GameDetailed">
<sequence>
<element name="ID_game" type="int"/>
<element name="league_ID" type="int"/>
<element name="LeagueCaption" type="string"/>
<element name="mode_ID" type="int"/>
<element name="ModeCaption" type="string"/>
<element name="group_ID" type="int"/>
<element name="GroupCaption" type="string"/>
<element name="RoundIndex" type="int"/>
<element name="PlayDate" type="string"/>
<element name="hall_ID" type="int"/>
<element name="HallCaption" type="string"/>
<element name="TeamHomeID" type="int"/>
<element name="TeamHomeCaption" type="string"/>
<element name="TeamAwayID" type="int"/>
<element name="TeamAwayCaption" type="string"/>
<element name="Sets" type="string"/>
<element name="Result" type="string"/>
</sequence>
</complexType>


 | 
 Sequenzdiagramm einer Anfrage
|



<?
/**
* Example class for Swiss-Volley Web Service
*
*/
class SoapExample {
/**
* The SoapClient instance
*
* @var SoapClient
*/
private $obj_soap;
/**
* Connects to Soap-Server
*
* @throws SoapFault
* @param string $str_wsdlfile
*/
public function connect($str_wsdlfile){
$this->obj_soap = new SoapClient($str_wsdlfile);
}
/**
* Returns the league overview with its groups. This method should
* be cached. Because this operations are time-critical and the returned
* values cache only once a season.
*
* @param string $str_keyword
* @throws SoapFault
* @return array
*/
public function getLeagues($str_keyword){
$arr_ret = array();
$arr_leagues = $this->obj_soap->getLeagues($str_keyword);
foreach ($arr_leagues as $arr_current_league){
$currentLeague =& $arr_ret[$arr_current_league->Gender][$arr_current_league->league_ID];
$currentLeague["caption"] = utf8_decode($arr_current_league->Caption);
$arr_phases = $this->obj_soap->getPhases($arr_current_league->league_ID);
foreach ($arr_phases as $arr_current_phase){
$currentPhase =& $currentLeague["phases"][$arr_current_phase->phase_ID];
$currentPhase["caption"] = utf8_decode($arr_current_phase->Caption);
$arr_groups = $this->obj_soap->getGroups($arr_current_phase->phase_ID);
foreach ($arr_groups as $arr_current_group){
$currentGroup =& $currentPhase["groups"][$arr_current_group->group_ID];
$currentGroup = utf8_decode($arr_current_group->Caption);
}
}
}
return $arr_ret;
}
/**
* Return a overview of the given group
*
* @param int $group_ID The unique id of the group.
*/
public function getGroupOverview ($group_ID){
require_once("Date.php");
// More information of this group
$arr_groupInfo = $this->obj_soap->getGroupDetailed($group_ID);
// @todo do something with $arr_groupInfo for example return it or display it
// Games of a datespan of this group
$obj_dateStart = new Date(time());
$obj_dateEnd = new Date(strtotime("+3 week"));
$arr_gamesDateSpan = $this->obj_soap->getGamesDateSpan(
$group_ID,
$obj_dateStart->getDate(),
$obj_dateEnd->getDate()
);
// @todo do something with $arr_gamesDateSpan for example return it or display it
// Current Table (Ranking) of this group
$arr_table = $this->obj_soap->getTable($group_ID);
// @todo do something with $arr_table for example return it or display it
}
/**
* Return all games of a date span.
*
* @param string $keyword The keyword of the league (for example "NATIONAL")
* @return array
*/
public function getNextGames($keyword){
require_once("Date.php");
$obj_dateStart = new Date(time());
$obj_dateEnd = new Date(strtotime("+3 week"));
return $this->obj_soap->getGamesDateSpanAllGroups(
$keyword,
$obj_dateStart->getDate(),
$obj_dateEnd->getDate()
);
}
}
// Exceptions must be catched!!!
$obj_example = new SoapExample();
// Connect to the server
$obj_example->connect("http://myvolley.volleyball.ch/SwissVolley.wsdl");
// Get overview
$arr_leagues = $obj_example->getLeagues("NATIONAL");
/*
Now we have all leagues and groups with its captions and genders
Group 28 for example is: NLB - f - Vorrunde - Ost
*/
$group_ID = 28;
// All information of this group
$str_groupOverview = $obj_example->getGroupOverview($group_ID);
// We can also retrieve all next games
$arr_gamesLeague = $obj_example->getNextGames("NATIONAL");
?>

|