]> git.donarmstrong.com Git - debbugs.git/blob - cgi/soap.cgi
53f7368536f4327b4a71b60acd59a9ce811250d8
[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      delete $typelookup->{$key} if defined $key and $key =~ /Month|Day|Year|date|time|duration/i;
32 }
33
34 our $warnings = '';
35 eval {
36     # Ignore stupid warning because elements (hashes) can't start with
37     # numbers
38     local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
39     $soap->handle;
40 };
41 die $@ if $@;
42 warn $warnings if length $warnings;