Skip to content

Commit 56664b4

Browse files
committed
Issue #5285: remove trailing whitespace from XML messages
before they are passed to SOAP::Lite::deserialize()
1 parent 44c8ef1 commit 56664b4

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

Kernel/GenericInterface/Transport/HTTP/SOAP.pm

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use PerlIO;
2929
use HTTP::Status;
3030
use Plack::Response;
3131
use SOAP::Lite; # for enabling debugging import +trace => 'all'
32+
use Text::Trim qw(rtrim);
3233

3334
# OTOBO modules
3435
use Kernel::System::VariableCheck qw(:all);
@@ -212,6 +213,10 @@ sub ProviderProcessRequest {
212213
Data => $Content,
213214
);
214215

216+
# Normalize Content by removing trailing white space.
217+
# This make SOAP::Lite work with XML::Parser >= 1.48.
218+
rtrim($Content);
219+
215220
# Deserialize data.
216221
my $Deserialized = eval { SOAP::Deserializer->deserialize($Content); };
217222
my $DeserializedFault = $@ || '';

scripts/test/GenericInterface/Transport/HTTP/SOAP/ContentCharset.t

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1515
# --
1616

17+
use v5.24;
1718
use strict;
1819
use warnings;
19-
use v5.24;
2020
use utf8;
2121

2222
# core modules
@@ -104,6 +104,10 @@ plan( scalar @Tests );
104104

105105
for my $Test (@Tests) {
106106

107+
# This test request XML has a trailing newline. There have been problems with that
108+
# when XML::Parser >= 1.48 is used.
109+
# Therefore Kernel::GenericInterface::Transport::HTTP::SOAP::ProviderProcessRequest()
110+
# has been tweaked to trim trailing white space.
107111
my $Request = << "END_XML";
108112
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tic="http://www.otobo.org/TicketConnector/">
109113
<soapenv:Header/>
@@ -114,7 +118,6 @@ for my $Test (@Tests) {
114118
</soapenv:Body>
115119
</soapenv:Envelope>
116120
END_XML
117-
118121
$EncodeObject->EncodeOutput( \$Request );
119122

120123
# Fake STDIN and fill it with the request.

0 commit comments

Comments
 (0)