informatique:reseau:messagerie:sympa

Ceci est une ancienne révision du document !


Sympa

  1. Dans la configuration Apache, activer le ScriptAlias spécifique à l'API SOAP :
    ScriptAlias /sympasoap /usr/lib/cgi-bin/sympa/sympa_soap_server-wrapper.fcgi
  2. Dans la configuration de Sympa :
    1. Créer le fichier /etc/sympa/trusted_applications.conf. Exemple :
      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
    2. 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 :
      ## The base URL of Sympa's SOAP server
      soap_url https://listes.example.org/sympasoap
  3. Recharger la configuration de Sympa et d'Apache
    service sympa reload
    service apache2 reload

Vous devriez désormais avoir accès au WSDL de l'API SOAP :

curl https://listes.example.org/wws/wsdl
Le fichier WSDL est au format XML. Dans navigateur, l'accès à ce fichier affiche souvent une page blanche et il faut afficher les sources de la page pour voir le contenu.

Configuration

<?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');

Requêtes

<?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));
}
  • informatique/reseau/messagerie/sympa.1559809746.txt.gz
  • Dernière modification : 2019/06/06 08:29
  • de bn8