sympa_soap_server.fcgi.in 3.22 KB
Newer Older
1
#! --PERL--
2
3
# -*- indent-tabs-mode: nil; -*-
# vim:ft=perl:et:sw=4
4
# $Id$
salaun's avatar
salaun committed
5

6
7
8
9
10
# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright (c) 1997, 1998, 1999 Institut Pasteur & Christophe Wolfhugel
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
11
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
12
13
14
# Copyright 2017 The Sympa Community. See the AUTHORS.md file at the top-level
# directory of this distribution and at
# <https://github.com/sympa-community/sympa.git>.
15
16
17
18
19
20
21
22
23
24
25
26
27
#
# 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, see <http://www.gnu.org/licenses/>.
salaun's avatar
salaun committed
28

29
use lib split(/:/, $ENV{SYMPALIB} || ''), '--modulesdir--';
30
31
use strict;
use warnings;
32
use English qw(-no_match_vars);
salaun's avatar
salaun committed
33
use SOAP::Lite;
34

salaun's avatar
salaun committed
35
36
## Sympa API
use Conf;
37
use Sympa::Alarm;
38
use Sympa::DatabaseManager;
39
use Sympa::List;
40
use Sympa::Log;
41
42
use Sympa::SOAP;
use Sympa::SOAP::Transport;
salaun's avatar
salaun committed
43

44
my $birthday = time;
45

salaun's avatar
salaun committed
46
## Load sympa config
47
unless (Conf::load()) {
48
    printf STDERR
49
50
        "Unable to load sympa configuration, file %s or one of the vhost robot.conf files contain errors. Exiting\n",
        Conf::get_sympa_conf();
51
    exit 1;
salaun's avatar
salaun committed
52
53
}

54
55
56
57
58
# Open log
my $log = Sympa::Log->instance;
$log->{level} = $Conf::Conf{'log_level'};
$log->openlog(
    $Conf::Conf{'log_facility'} || $Conf::Conf{'syslog'},
59
60
61
    $Conf::Conf{'log_socket_type'},
    service => 'sympasoap'
);
62
$log->syslog('info', 'SympaSOAP started');
salaun's avatar
salaun committed
63

64
## We set the real UID with the effective UID value
65
## It is useful to allow execution of scripts like alias_manager
66
## that otherwise might loose the benefit of SetUID
67
68
$UID = $EUID;    ## UID
$GID = $EGID;    ## GID
69

70
unless (Sympa::DatabaseManager->instance) {
71
    $log->syslog('err', 'SympaSOAP requires a RDBMS to run');
sympa-authors's avatar
sympa-authors committed
72
}
salaun's avatar
salaun committed
73

salaun's avatar
salaun committed
74
75
## The process should not fork for sending mail
## Messages will be spooled instead
76
Sympa::Alarm->instance->{use_bulk} = 1;
salaun's avatar
salaun committed
77

salaun's avatar
salaun committed
78
## Loading all Lists at startup, in order to increase execution speed
79

80
my $all_lists = Sympa::List::get_lists('*');
salaun's avatar
salaun committed
81

82
##############################################################################
salaun's avatar
salaun committed
83
#    Soap part
84
##############################################################################
salaun's avatar
salaun committed
85

86
my $server = Sympa::SOAP::Transport->new();
salaun's avatar
salaun committed
87

88
89
$server->dispatch_with({'urn:sympasoap' => 'Sympa::SOAP'});
#$server->dispatch_to('--modulesdir--', 'Sympa::SOAP');
salaun's avatar
salaun committed
90

91
$server->handle($birthday);
92
93
94
95
96
97
98
99
100
101
102

__END__

=encoding utf-8

=head1 NAME

sympa_soap_server, sympa_soap_server.fcgi - Sympa SOAP server

=head1 DESCRIPTION

103
Sympa SOAP server allows one to access Sympa service though SOAP.
104
105
106
107
108
109
110
111
112

To know details on Sympa SOAP server, see Reference Manual:
L<https://www.sympa.org/manual/soap>.

=head1 HISTORY

Sympa SOAP server appeared on Sympa 4.0.

=cut