]> git.donarmstrong.com Git - debbugs.git/blob - cgi/soap.cgi
merge changes from dla source
[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 # to work around the serializer improperly using date/time stuff
23 # (Nothing in Debbugs should be looked at as if it were date/time) we
24 # kill off all of the date/time related bits in the serializer.
25 my $typelookup = $soap->serializer()->{_typelookup};
26 for my $key (keys %{$typelookup}) {
27      delete $typelookup->{$key} if defined $key and $key =~ /Month|Day|Year|date|time|duration/i;
28 }
29
30 our $warnings = '';
31 eval {
32     # Ignore stupid warning because elements (hashes) can't start with
33     # numbers
34     local $SIG{__WARN__} = sub {$warnings .= $_[0] unless $_[0] =~ /Cannot encode unnamed element/};
35     $soap->handle;
36 };
37 die $@ if $@;
38 warn $warnings if length $warnings;