Skip to content

Commit

Permalink
Merge pull request #1592 from ikedas/issue-1541_try2
Browse files Browse the repository at this point in the history
Broken output with SOAP API due to mixture of byte- and utf8-strings (#1541)
  • Loading branch information
racke committed Dec 7, 2023
2 parents 8967810 + a27dd02 commit f71d7fb
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 213 deletions.
7 changes: 3 additions & 4 deletions src/cgi/sympa_soap_server.fcgi.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2018, 2019, 2022 The Sympa Community. See the
# Copyright 2017, 2018, 2019, 2022, 2023 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>.
#
Expand Down Expand Up @@ -39,7 +39,7 @@ use Sympa::List;
use Sympa::Log;
use Sympa::Spool::Listmaster;
use Sympa::WWW::SOAP;
use Sympa::WWW::SOAP::Transport;
use Sympa::WWW::SOAP::FastCGI;

## Load sympa config
unless (Conf::load()) {
Expand Down Expand Up @@ -81,8 +81,7 @@ my $all_lists = Sympa::List::get_lists('*');
# Soap part
##############################################################################

Sympa::WWW::SOAP::Transport->new(
cookie_expire => $Conf::Conf{'cookie_expire'})
Sympa::WWW::SOAP::FastCGI->new(cookie_expire => $Conf::Conf{'cookie_expire'})
->dispatch_with({'urn:sympasoap' => 'Sympa::WWW::SOAP'})->handle;

__END__
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Copyright (c) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009, 2010, 2011 Comite Reseau des Universites
# Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017 GIP RENATER
# Copyright 2017, 2018, 2019, 2021, 2022 The Sympa Community. See the
# Copyright 2017, 2018, 2019, 2021, 2022, 2023 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>.
#
Expand Down Expand Up @@ -242,7 +242,7 @@ nonCLI_modules = \
Sympa/WWW/SharedDocument.pm \
Sympa/WWW/Session.pm \
Sympa/WWW/SOAP.pm \
Sympa/WWW/SOAP/Transport.pm \
Sympa/WWW/SOAP/FastCGI.pm \
Sympa/WWW/Tools.pm
nobase_modules_DATA = $(CLI_modules) $(nonCLI_modules)

Expand Down
17 changes: 9 additions & 8 deletions src/lib/Sympa/CLI/test/soap.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# Sympa - SYsteme de Multi-Postage Automatique
#
# Copyright 2022 The Sympa Community. See the
# Copyright 2022, 2023 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>.
#
Expand All @@ -24,6 +24,7 @@ package Sympa::CLI::test::soap;

use strict;
use warnings;
use Encode qw();
use Getopt::Long;
use HTTP::Cookies;
use SOAP::Lite;
Expand Down Expand Up @@ -72,8 +73,8 @@ sub _run {
}

play_soap_as_trusted($soap_url, $trusted_application,
$trusted_application_password, $service, $proxy_vars,
$service_parameters);
$trusted_application_password, $proxy_vars,
$service, $service_parameters);
} elsif ($service eq 'getUserEmailByCookie') {
play_soap(
$soap_url,
Expand Down Expand Up @@ -110,8 +111,8 @@ sub play_soap_as_trusted {
my $soap_url = shift;
my $trusted_application = shift;
my $trusted_application_password = shift;
my $service = shift;
my $proxy_vars = shift;
my $service = shift;
my $service_parameters = shift;

my $soap = SOAP::Lite->new();
Expand All @@ -124,9 +125,8 @@ sub play_soap_as_trusted {
} else {
@parameters = ();
}
my $p = join(',', @parameters);
printf
"calling authenticateRemoteAppAndRun( $trusted_application, $trusted_application_password, $proxy_vars,$service,$p)\n";
printf "calling authenticateRemoteAppAndRun( %s, ?, %s, %s, %s )\n",
$trusted_application, $proxy_vars, $service, join ',', @parameters;

my $reponse =
$soap->authenticateRemoteAppAndRun($trusted_application,
Expand Down Expand Up @@ -290,7 +290,8 @@ sub _dump_var {
} elsif (ref $var) {
printf "%s'%s'\n", "\t" x $level, ref $var;
} elsif (defined $var) {
printf "%s'%s'\n", "\t" x $level, $var;
printf "%s'%s'\n", "\t" x $level,
Encode::is_utf8($var) ? Encode::encode_utf8($var) : $var;
} else {
printf "%sUNDEF\n", "\t" x $level;
}
Expand Down
Loading

0 comments on commit f71d7fb

Please sign in to comment.