From c387f4db6121b465c4d10035d8082eee3c016ef0 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Fri, 3 Nov 2006 04:03:46 +0000 Subject: Bug 355837: Make the webservice able to create bugs (bz_webservice_demo part) Patch By Mads Bondo Dydensborg r=mkanat, a=justdave --- contrib/bz_webservice_demo.pl | 50 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'contrib') diff --git a/contrib/bz_webservice_demo.pl b/contrib/bz_webservice_demo.pl index aba7544f0..31ca880a6 100755 --- a/contrib/bz_webservice_demo.pl +++ b/contrib/bz_webservice_demo.pl @@ -48,6 +48,7 @@ my $Bugzilla_password; my $Bugzilla_remember; my $bug_id; my $product_name; +my $create_file_name; GetOptions('help|h|?' => \$help, 'uri=s' => \$Bugzilla_uri, @@ -56,6 +57,7 @@ GetOptions('help|h|?' => \$help, 'rememberlogin!' => \$Bugzilla_remember, 'bug_id:s' => \$bug_id, 'product_name:s' => \$product_name, + 'create:s' => \$create_file_name ) or pod2usage({'-verbose' => 0, '-exitval' => 1}); =head1 OPTIONS @@ -99,6 +101,10 @@ Pass a bug ID to have C do some bug-related test calls. Pass a product name to have C do some product-related test calls. +=item --create + +Specify a file that contains settings for the creating of a new bug. + =back =head1 DESCRIPTION @@ -238,6 +244,33 @@ if ($product_name) { } } +=head2 Creating A Bug + +Call C with the settings read from the file indicated on +the command line. The file must contain a valid anonymous hash to use +as argument for the call to C. +The call will return a hash with a bug id for the newly created bug. + +=cut + +if ($create_file_name) { + $soapresult = $proxy->call('Bug.create', do "$create_file_name" ); + _die_on_fault($soapresult); + $result = $soapresult->result; + + if (ref($result) eq 'HASH') { + foreach (keys(%$result)) { + print "$_: $$result{$_}\n"; + } + } + else { + print "$result\n"; + } + +} + + + =head1 NOTES =head2 Character Set Encoding @@ -247,6 +280,23 @@ encoding as Bugzilla does, or that it converts correspondingly when using the web service API. By default, Bugzilla uses UTF-8 as its character set encoding. +=head2 Format For Create File + +The create format file is a piece of Perl code, that should look something like +this: + + { + product => "TestProduct", + component => "TestComponent", + summary => "TestBug - created from bz_webservice_demo.pl", + version => "unspecified", + description => "This is a description of the bug... hohoho", + op_sys => "All", + platform => "All", + priority => "P4", + severity => "normal" + }; + =head1 SEE ALSO There are code comments in C which might be of further -- cgit v1.2.3-24-g4f1b