]> git.donarmstrong.com Git - debbugs.git/blobdiff - cgi/soap.cgi
Add Debbugs::BugWalker to abstract out bug-walking code in
[debbugs.git] / cgi / soap.cgi
index 04d72652b72dcd2393f972ac0d24bec93be13306..53f7368536f4327b4a71b60acd59a9ce811250d8 100755 (executable)
@@ -1,16 +1,42 @@
-#!/usr/bin/perl -wT
+#!/usr/bin/perl -T
 
-package debbugs;
+use warnings;
+use strict;
 
-use SOAP::Transport::HTTP;
+#use SOAP::Transport::HTTP;
 
-use Debbugs::SOAP::Usertag;
-use Debbugs::SOAP::Status;
+use Debbugs::SOAP::Server;
 
-my $soap = SOAP::Transport::HTTP::CGI
-    -> dispatch_to('Debbugs::SOAP::Usertag', 'Debbugs::SOAP::Status');
-$soap->serializer()->soapversion(1.2);
+# 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-> handle;
+*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}) {
+     delete $typelookup->{$key} if defined $key and $key =~ /Month|Day|Year|date|time|duration/i;
+}
 
+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;