]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 355837: Make the webservice able to create bugs (bz_webservice_demo part)
authormkanat%bugzilla.org <>
Fri, 3 Nov 2006 04:03:46 +0000 (04:03 +0000)
committermkanat%bugzilla.org <>
Fri, 3 Nov 2006 04:03:46 +0000 (04:03 +0000)
Patch By Mads Bondo Dydensborg <mbd@dbc.dk> r=mkanat, a=justdave

contrib/bz_webservice_demo.pl

index aba7544f0169126a51081eea8d560fbd6062d987..31ca880a601354f669f1e04f5c207d629172e4d5 100755 (executable)
@@ -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<bz_webservice_demo.pl> do some bug-related test calls.
 Pass a product name to have C<bz_webservice_demo.pl> 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<Bug.create> 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<Bug.create>.
+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<bz_webservice_demo.pl> which might be of further