Cette page est en lecture seule. Vous pouvez afficher le texte source, mais ne pourrez pas le modifier. Contactez votre administrateur si vous pensez qu'il s'agit d'une erreur. ====== Sympa ====== ===== Webservice SOAP ===== ==== Activation ==== - Dans la configuration Apache, activer le //ScriptAlias// spécifique à l'API SOAP : <code apache>ScriptAlias /sympasoap /usr/lib/cgi-bin/sympa/sympa_soap_server-wrapper.fcgi</code> - Dans la configuration de Sympa : - Créer le fichier ///etc/sympa/trusted_applications.conf//. Exemple : <code yaml>trusted_application # name of the trusted application. This is the appname soap element name LdapSaisie # # the md5 digest of the application pasword. You can get it with : # /usr/lib/sympa/bin/sympa.pl --md5_digest=<the password> md5password 5ebe2294ecd0e0f08eab7690d2a6ee69 # # the comma separated list of vars the trusted application can set. proxy_for_variables USER_EMAIL,remote_host </code> - Dans le fichier //robot.conf// de votre domaine de liste de messagerie (///etc/sympa/listes.example.org/robot.conf// par exemple), ajouter la directive //soap_url// : <code yaml>## The base URL of Sympa's SOAP server soap_url https://listes.example.org/sympasoap</code> - Recharger la configuration de Sympa et d'Apache <code bash>service sympa reload service apache2 reload</code> Vous devriez désormais avoir accès au ''WSDL'' de l'API SOAP : <code bash>curl https://listes.example.org/wws/wsdl</code> <note tip>Le fichier //WSDL// est au format //XML//. Dans un navigateur, l'accès à ce fichier affiche le plus souvent une page blanche et il faut alors afficher les sources de la page pour voir son contenu.</note> ==== Exemple d'utilisation en PHP ==== === Configuration === <code php><?php // Sympa SOAP webservice WSDL URL define('SYMPA_WSDL_URL','https://listes.example/wws/wsdl'); // Sympa SOAP webservice remote application name define('SYMPA_REMOTE_APP_NAME','LdapSaisie'); // Sympa SOAP webservice remote application password define('SYMPA_REMOTE_APP_PASSWORD','secret'); // Sympa robot host name define('SYMPA_HOST','listes.example.org'); // Sympa listmaster email used by LdapSaisie define('SYMPA_LISTMASTER_EMAIL','ldapsaisie@example.org'); </code> === Requêtes === <code php><?php function make_sympa_soap_request($method, $params=array()) { try { $client = new SoapClient(SYMPA_WSDL_URL); $result = $client->authenticateRemoteAppAndRun( SYMPA_REMOTE_APP_NAME, SYMPA_REMOTE_APP_PASSWORD, "USER_EMAIL=".SYMPA_LISTMASTER_EMAIL.",SYMPA_ROBOT=".SYMPA_HOST, $method, $params ); } catch (SoapFault $fault) { error_log(sprintf("Sympa SOAP : An error occured calling Sympa SOAP webservice. The fault code return is %s with message : %s", $fault->faultcode, $fault->faultstring)); return False; } return $result; } function getListMailingLists() { return make_sympa_soap_request('complexLists'); } function getMailingListInfos($list) { return make_sympa_soap_request('info', array($list)); } function getMailingListMembers($list) { return make_sympa_soap_request('review', array($list)); } </code>