Commit c387f4db authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 355837: Make the webservice able to create bugs (bz_webservice_demo part)

Patch By Mads Bondo Dydensborg <mbd@dbc.dk> r=mkanat, a=justdave
parent 98fd6a92
...@@ -48,6 +48,7 @@ my $Bugzilla_password; ...@@ -48,6 +48,7 @@ my $Bugzilla_password;
my $Bugzilla_remember; my $Bugzilla_remember;
my $bug_id; my $bug_id;
my $product_name; my $product_name;
my $create_file_name;
GetOptions('help|h|?' => \$help, GetOptions('help|h|?' => \$help,
'uri=s' => \$Bugzilla_uri, 'uri=s' => \$Bugzilla_uri,
...@@ -56,6 +57,7 @@ GetOptions('help|h|?' => \$help, ...@@ -56,6 +57,7 @@ GetOptions('help|h|?' => \$help,
'rememberlogin!' => \$Bugzilla_remember, 'rememberlogin!' => \$Bugzilla_remember,
'bug_id:s' => \$bug_id, 'bug_id:s' => \$bug_id,
'product_name:s' => \$product_name, 'product_name:s' => \$product_name,
'create:s' => \$create_file_name
) or pod2usage({'-verbose' => 0, '-exitval' => 1}); ) or pod2usage({'-verbose' => 0, '-exitval' => 1});
=head1 OPTIONS =head1 OPTIONS
...@@ -99,6 +101,10 @@ Pass a bug ID to have C<bz_webservice_demo.pl> do some bug-related test calls. ...@@ -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 Pass a product name to have C<bz_webservice_demo.pl> do some product-related
test calls. test calls.
=item --create
Specify a file that contains settings for the creating of a new bug.
=back =back
=head1 DESCRIPTION =head1 DESCRIPTION
...@@ -238,6 +244,33 @@ if ($product_name) { ...@@ -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 =head1 NOTES
=head2 Character Set Encoding =head2 Character Set Encoding
...@@ -247,6 +280,23 @@ encoding as Bugzilla does, or that it converts correspondingly when using the ...@@ -247,6 +280,23 @@ encoding as Bugzilla does, or that it converts correspondingly when using the
web service API. web service API.
By default, Bugzilla uses UTF-8 as its character set encoding. 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 =head1 SEE ALSO
There are code comments in C<bz_webservice_demo.pl> which might be of further There are code comments in C<bz_webservice_demo.pl> which might be of further
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment