LDAP: couldn't connect to LDAP server
Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
lpro:ws [2017/12/11 14:26] jbaudry [Exercice 4 : Créer son WebService (Quel jour ?) en PHP (client PHP/Java)] |
lpro:ws [2017/12/18 09:58] (current) jbaudry [Liens webservices] |
||
|---|---|---|---|
| Line 20: | Line 20: | ||
| {{:lpro:05-rest.pdf| Introduction REST}} | {{:lpro:05-rest.pdf| Introduction REST}} | ||
| + | |||
| + | ==== Liens webservices ==== | ||
| + | * http://litis.univ-lehavre.fr/wiki/lpro/ws/rest | ||
| + | * Livres | ||
| + | * https://www.googleapis.com/books/v1/volumes?q=isbn:0747532699 | ||
| + | * Adresse | ||
| + | * https://maps.googleapis.com/maps/api/geocode/json?address=universite%20du%20havre,%20france&sensor=false | ||
| + | * Iceland API gouv | ||
| + | * http://docs.apis.is/ | ||
| + | * Photos | ||
| + | * https://www.flickr.com/services/feeds/docs/photos_public/ | ||
| + | * Pays | ||
| + | * https://restcountries.eu | ||
| + | * Pays 2 | ||
| + | * https://geo.api.gouv.fr/communes?codePostal=76600&fields=nom,code,codesPostaux,codeDepartement,codeRegion,population&format=json&geometry=centre' | ||
| + | * Adresses | ||
| + | * https://adresse.data.gouv.fr/api/ | ||
| + | |||
| * http://blog.programmableweb.com/2012/01/11/12-json-weather-apis/ | * http://blog.programmableweb.com/2012/01/11/12-json-weather-apis/ | ||
| * [[lpro:ws:rest_php|Exemple en php]] | * [[lpro:ws:rest_php|Exemple en php]] | ||
| * WSDL : http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl | * WSDL : http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl | ||
| - | * WSDL : | + | * WSDL La poste : {{ :lpro:spec_ws_suivi_en.pdf |}} |
| Line 230: | Line 248: | ||
| </code> | </code> | ||
| + | * WSDL : server | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | // Pour supprimer le cache du web-service | ||
| + | ini_set('soap.wsdl_cache_enabled', 0); | ||
| + | // Pour définir le temp maximal d'éxecution de notre web-service | ||
| + | ini_set('default_socket_timeout', 180); | ||
| + | |||
| + | // Nom de notre web-service | ||
| + | class Server { | ||
| + | // Le service QuelJour que l'on a définit dans notre format wsdl | ||
| + | |||
| + | function bonjour($parm) { | ||
| + | return "bonjour ".$parm ; | ||
| + | } | ||
| + | } | ||
| + | |||
| + | |||
| + | // On tente d'instancier la classe soapServer | ||
| + | // Si cela s'avère impossible, on affiche une erreur | ||
| + | try { | ||
| + | $server = new SoapServer('Hello.wsdl', array('trace' => 1,'encoding' => 'ISO-8859-1')); | ||
| + | // On définit la classe qui va gérer les requêtes SOAP (pour nous c'est la class Server) | ||
| + | $server->setclass('Server'); | ||
| + | $server->setPersistence(SOAP_PERSISTENCE_REQUEST); | ||
| + | } catch (Exception $e) { | ||
| + | echo 'erreur'.$e; | ||
| + | } | ||
| + | |||
| + | |||
| + | /* | ||
| + | * Gestion des requêtes | ||
| + | */ | ||
| + | |||
| + | // Si l'appel provient d'un Web-Service | ||
| + | if ($_SERVER['REQUEST_METHOD'] == 'POST') { | ||
| + | try { | ||
| + | $server -> handle();} | ||
| + | catch (Exception $e) { | ||
| + | echo 'erreur'.$e; | ||
| + | } | ||
| + | } | ||
| + | // Facultatif seulement pour montrer les fonctions disponibles par le web-service | ||
| + | else { | ||
| + | echo '<strong>This SOAP server can handle following functions : </strong>'; | ||
| + | echo '<ul>'; | ||
| + | foreach($server -> getFunctions() as $func) { | ||
| + | echo '<li>' , $func , '</li>'; | ||
| + | } | ||
| + | echo '</ul>'; | ||
| + | } | ||
| + | |||
| + | |||
| + | ?> | ||
| + | </code> | ||
| ====== Exercice 5 : Manipuler le format JSON (open data Nantes) ====== | ====== Exercice 5 : Manipuler le format JSON (open data Nantes) ====== | ||