From c69c8a9235e885cd9ce6d5c984381afb3dbecb9e Mon Sep 17 00:00:00 2001 From: Dave Lawrence Date: Wed, 15 Feb 2012 11:02:52 -0500 Subject: Bug 724464 - JSON-RPC support shouldn't require SOAP::Lite r/a=LpSolit --- Bugzilla/WebService.pm | 20 -------------------- Bugzilla/WebService/Server/XMLRPC.pm | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 20 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/WebService.pm b/Bugzilla/WebService.pm index c428e10ec..88ffa3f96 100644 --- a/Bugzilla/WebService.pm +++ b/Bugzilla/WebService.pm @@ -11,8 +11,6 @@ package Bugzilla::WebService; use strict; use Bugzilla::WebService::Server; -use XMLRPC::Lite; - # Used by the JSON-RPC server to convert incoming date fields apprpriately. use constant DATE_FIELDS => {}; # Used by the JSON-RPC server to convert incoming base64 fields appropriately. @@ -30,24 +28,6 @@ sub login_exempt { return $class->LOGIN_EXEMPT->{$method}; } -sub type { - my ($self, $type, $value) = @_; - if ($type eq 'dateTime') { - $value = $self->datetime_format_outbound($value); - } - return XMLRPC::Data->type($type)->value($value); -} - -# This is the XML-RPC implementation, see the README in Bugzilla/WebService/. -# Our "base" implementation is in Bugzilla::WebService::Server. -sub datetime_format_outbound { - my $self = shift; - my $value = Bugzilla::WebService::Server->datetime_format_outbound(@_); - # XML-RPC uses an ISO-8601 format that doesn't have any hyphens. - $value =~ s/-//g; - return $value; -} - 1; __END__ diff --git a/Bugzilla/WebService/Server/XMLRPC.pm b/Bugzilla/WebService/Server/XMLRPC.pm index 5338d8b5a..67e7b7555 100644 --- a/Bugzilla/WebService/Server/XMLRPC.pm +++ b/Bugzilla/WebService/Server/XMLRPC.pm @@ -18,6 +18,20 @@ if ($ENV{MOD_PERL}) { use Bugzilla::WebService::Constants; +# Allow WebService methods to call XMLRPC::Lite's type method directly +BEGIN { + *Bugzilla::WebService::type = sub { + my ($self, $type, $value) = @_; + if ($type eq 'dateTime') { + # This is the XML-RPC implementation, see the README in Bugzilla/WebService/. + # Our "base" implementation is in Bugzilla::WebService::Server. + $value = Bugzilla::WebService::Server->datetime_format_outbound($value); + $value =~ s/-//g; + } + return XMLRPC::Data->type($type)->value($value); + }; +} + sub initialize { my $self = shift; my %retval = $self->SUPER::initialize(@_); -- cgit v1.2.3-24-g4f1b