]> git.donarmstrong.com Git - debbugs.git/blob - cgi/soap.cgi
use scalar IO::InnerFile::getline to work around an InnerFile bug
[debbugs.git] / cgi / soap.cgi
1 #!/usr/bin/perl -T
2
3 use warnings;
4 use strict;
5
6 #use SOAP::Transport::HTTP;
7
8 use Debbugs::SOAP::Server;
9
10 # Work around stupid soap bug on line 411
11 if (not exists $ENV{EXPECT}) {
12      $ENV{EXPECT} = '';
13 }
14
15 my $soap = Debbugs::SOAP::Server
16 #my $soap = SOAP::Transport::HTTP::CGI
17     -> dispatch_to('Debbugs::SOAP');
18 #$soap->serializer()->soapversion(1.2);
19 # soapy is stupid, and is using the 1999 schema; override it.
20 *SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
21 *SOAP::Serializer::as_anyURI       = \&SOAP::XMLSchema2001::Serializer::as_string;
22 # do this twice to avoid the warning if the serializer doesn't get
23 # used
24 *SOAP::XMLSchema1999::Serializer::as_base64Binary = \&SOAP::XMLSchema2001::Serializer::as_base64Binary;
25 *SOAP::Serializer::as_anyURI       = \&SOAP::XMLSchema2001::Serializer::as_string;
26 # to work around the serializer improperly using date/time stuff
27 # (Nothing in Debbugs should be looked at as if it were date/time) we
28 # kill off all of the date/time related bits in the serializer.
29 my $typelookup = $soap->serializer()->{_typelookup};
30 for my $key (keys %{$typelookup}) {
31     if (defined $key and
32         $key =~ /Month|Day|Year|date|time|duration/i
33        ) {
34         # set the sub to always return 0
35         $typelookup->{$key}[1] = sub { 0 };
36     }
37 }
38
39 our $warnings = '';
40 eval {
41     # Ignore stupid warning because elements (hashes) can't start with
42     # numbers
43     local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
44     $soap->handle;
45 };
46 die $@ if $@;
47 warn $warnings if length $warnings;