File: soap.cgi

package info (click to toggle)
debbugs 2.6.4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,800 kB
  • sloc: perl: 19,270; makefile: 81; sh: 75
file content (47 lines) | stat: -rwxr-xr-x 1,619 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/perl -T

use warnings;
use strict;

#use SOAP::Transport::HTTP;

use Debbugs::SOAP::Server;

# Work around stupid soap bug on line 411
if (not exists $ENV{EXPECT}) {
     $ENV{EXPECT} = '';
}

my $soap = Debbugs::SOAP::Server
#my $soap = SOAP::Transport::HTTP::CGI
    -> dispatch_to('Debbugs::SOAP');
#$soap->serializer()->soapversion(1.2);
# soapy is stupid, and is using the 1999 schema; override it.
*SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
*SOAP::Serializer::as_anyURI       = \&SOAP::XMLSchema2001::Serializer::as_string;
# do this twice to avoid the warning if the serializer doesn't get
# used
*SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
*SOAP::Serializer::as_anyURI       = \&SOAP::XMLSchema2001::Serializer::as_string;
# to work around the serializer improperly using date/time stuff
# (Nothing in Debbugs should be looked at as if it were date/time) we
# kill off all of the date/time related bits in the serializer.
my $typelookup = $soap->serializer()->{_typelookup};
for my $key (keys %{$typelookup}) {
    if (defined $key and
        $key =~ /Month|Day|Year|date|time|duration/i
       ) {
        # set the sub to always return 0
        $typelookup->{$key}[1] = sub { 0 };
    }
}

our $warnings = '';
eval {
    # Ignore stupid warning because elements (hashes) can't start with
    # numbers
    local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
    $soap->handle;
};
die $@ if $@;
warn $warnings if length $warnings;