I need to write a perl script which would query testopia and also
update testopia fields like test results etc. I have just installed
bugzilla 3.0.1 and testopia 1.3 and want to use the XML-RPC feature to
do my tasks.
I can log into bugzilla and have created a fresh testplan with an id
of 1, and can also see it in the database, but when I query using XML-
RPC i get errors.
I have written the following test code looking up documentation at
http://wiki.mozilla.org/Testopia:Documentation:XMLRPC
-------------------
#!/usr/bin/perl
use strict;
use warnings;
#use SOAP::Transport::HTTP;
use XMLRPC::Lite;
my $proxy = XMLRPC::Lite->proxy("http://localhost/bugzilla-3.0.1/
xmlrpc.cgi");
my $soapresult = $proxy->call('TestPlan.get', {plan_id=>1});
---------------------
The last line fails. Is this all we need to write to get results? I
get this error on execution
$ ./update_testopia.pl
500 Internal Server Error at ./update_testopia.pl line 10
$
I have also tried using the following code with the same results
print XMLRPC::Lite
->proxy("http://localhost/bugzilla-3.0.1/xmlrpc.cgi")
->call('TestPlan.get',{plan_id=>1})
->result;
The httpd error log shows
[Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Use of
uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/
5.8.5/SOAP/Transport/HTTP.pm line 411.
[Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Use of
uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/
5.8.5/SOAP/Lite.pm line 2463.
[Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Undefined
subroutine &Bugzilla::WebService::Constants::ERROR_FAULT_SERVER called
at Bugzilla/WebService.pm line 113.
[Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Premature end of
script headers: xmlrpc.cgi
The httpd access logs shows:
127.0.0.1 - - [14/Sep/2007:00:15:35 +0530] "POST /bugzilla-3.0.1/
xmlrpc.cgi HTTP/1.1" 500 610 "-" "SOAP::Lite/Perl/0.69"
I think this may be some configuration/trivial mistake on my part. I
am not sure if the URL we pass as proxy should include xmlrpc.cgi, but
without that I used to get an XML "mismatched tag" error.
This is a bit urgent, can some one please give me a push here?
Thanks in advance,
Santosh
The Testopia CGI you want is tr_xmlrpc.cgi
The one you're using (xmlrpc.cgi) is for Bugzilla.
Regards,
Vance
Hi Mr Vance,
Thanks for your reply. I used tr_xmlrpc.cgi this time and still get
the same 500 Internal Server Error. The httpd log shows
[Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Use of
uninitialized value in pattern match (m//) at
/usr/lib/perl5/site_perl/5.8.5/SOAP/Transport/HTTP.pm line 411.
[Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Undefined
subroutine &Bugzilla::WebService::Constants::ERROR_FAULT_SERVER called
at Bugzilla/WebService.pm line 113.
[Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Premature end of
script headers: tr_xmlrpc.cgi
I am running this inside a virtual machine if that makes any
difference. But since I have bugzilla and testopia working I don't
think this should matter.
Regards,
Santosh
Workaround -- add this to Bugzilla/WebService/Constants.pm, just after the definition of ERROR_GENERAL:
# RPC Fault Code must be an integer
use constant ERROR_FAULT_SERVER => 998;
Also, note that testopia does not yet support bugzilla 3.0.1 (https://bugzilla.mozilla.org/show_bug.cgi?id=395958)
Regards,
Vance
>>> On 9/14/2007 at 12:58 AM, in message
<8d878f150709132358x5bd...@mail.gmail.com>, "Santosh Sugur"
<santos...@gmail.com> wrote:
> Hi Mr Vance,
>
> Thanks for your reply. I used tr_xmlrpc.cgi this time and still get
> the same 500 Internal Server Error. The httpd log shows
>
> [Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Use of
> uninitialized value in pattern match (m//) at
> /usr/lib/perl5/site_perl/5.8.5/SOAP/Transport/HTTP.pm line 411.
> [Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Undefined
> subroutine &Bugzilla::WebService::Constants::ERROR_FAULT_SERVER called
> at Bugzilla/WebService.pm line 113.
> [Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Premature end of
> script headers: tr_xmlrpc.cgi
>
> I am running this inside a virtual machine if that makes any
> difference. But since I have bugzilla and testopia working I don't
> think this should matter.
>
>
> Regards,
> Santosh
>
> On 9/13/07, Vance Baarda <V...@novell.com> wrote:
>> >>> On 9/13/2007 at 10:06 AM, in message
>> <1189699566.4...@k79g2000hse.googlegroups.com>,
Thanks again! I have logged a bug as per your suggestion
https://bugzilla.mozilla.org/show_bug.cgi?id=396399
The previous error has now gone away after applying your workaround,
however I am still unable to get things working for me.
When I run the following code [I am giving my authorization details
(not shown here)]
use strict;
use warnings;
use SOAP::Transport::HTTP; # Need for Basic Authorization subroutine
use XMLRPC::Lite; # From the SOAP::Lite Module
my $proxy = XMLRPC::Lite->proxy("http://localhost/bugzilla-3.0/
tr_xmlrpc.cgi");
# Result is a hash map
my $soapresult = $proxy->call('TestPlan.get', 1);
# Error checking
die_on_fault($soapresult);
# Print each key/value pair
foreach (keys(%$soapresult))
{
print "$_: $$soapresult{$_}\n";
}
I get the following:
# ./update_testopia.pl
_content: ARRAY(0x9cd9890)
_context: XMLRPC::Lite=HASH(0x99a4b10)
_current: ARRAY(0x9cd9194)
and in the http log I get
[Tue Sep 18 00:11:20 2007] [error] [client 127.0.0.1] Use of
uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/
5.8.5/SOAP/Transport/HTTP.pm line 411.
The line 411 is
if ($ENV{EXPECT} =~ /\b100-Continue\b/i) {
print "HTTP/1.1 100 Continue\r\n\r\n";
in sub handle
What does this error mean?
How do I get the testplan details?
Thanks and Regards,
Santosh
Addendum:
If in the above code I print $soapresult using Data::Dumper I get a
huge listing in which I also get the data I am interested in
'author_id' => '1',
'name' =>
'Sample_Test_plan_1',
'default_product_version' => 'unspecified',
'plan_id' => '1',
'product_id' =>
'1',
'creation_date' =>
'2007-09-17 23:38:30',
'type_id' => '8',
'isactive' => '1'
How do I get just the hash map of key/value pairs for the result as
said in the documentation?
Also now in the above code in the call to TestPlan.get if I give
{plan_id=>1} as the value instead of the only '1' I get the following:
# ./update_testopia.pl
998 An internal error has occurred, but Bugzilla doesn't know
what non-empty-hash means.
If you are a Bugzilla end-user seeing this message, please save
this page and send it to santos...@xxxxx.com. at ./
update_testopia.pl line 35.
Line 35 is die $soapresult->faultcode . ' ' . $soapresult-
>faultstring;
Which is the correct usage?
Also I always get
[Tue Sep 18 02:30:47 2007] [error] [client 127.0.0.1] Use of
uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/
5.8.5/SOAP/Transport/HTTP.pm line 411.
in the httod error log
I know I may be asking too many (dumb) questions, but I need to get
this working. I really appreciate your help.
Many Thanks,
Santosh
It's just a warning, not an error.
> How do I get the testplan details?
I have forwarded your email to one of my colleagues. Perhaps he can help.
(I'm not the API guy. :-)
Regards,
Vance
Many Many thanks. Its working now.
Just one point. I happen to notice that in the documentation there are
a few places where the attribute types are said to be string but its
actually an integer.
Like on the create new test run page
http://wiki.mozilla.org/Testopia:Documentation:XMLRPC:TestRun we have
environment and manager and plan_text_version are mentioned as string
types but in the database there are shown as int
environment_id | int(11) | | MUL | 0
| |
| plan_text_version | int(11) | | MUL | 0
| |
| manager_id | mediumint(9) | | MUL | 0
| |
and when I give them as that (int) in my perl file it works. So I have
to use the environment id for updating testopia and not environment
name i see in testopia.
So does the documentation need to be updated?
Thanks and Regards,
Santosh
On 9/18/07, Jeff Dayley <jeda...@novell.com> wrote:
>
>
> Hi Santosh,
>
> In regards to the question "How do I get just the hash map of key/value
> pairs for the result as said in the documentation?".
>
> Try using 'my $hashresults = $soapresult->result' this should give you
> a results hash of the data you are after.
>
>
> Your next questions was "Also now in the above code in the call to
> TestPlan.get if I give {plan_id=>1} as the value instead of the only '1' I
> get the following: # ./update_testopia.pl 998 An internal error has
> occurred, but Bugzilla doesn't know what non-empty-hash means. If
> you are a Bugzilla end-user seeing this message, please save this page
> and send it to santos...@xxxxx.com. at ./ update_testopia.pl line 35.
> Line 35 is die $soapresult->faultcode . ' ' . $soapresult- >faultstring;
> Which is the correct usage?"
>
> TestPlan.get expects an integer not a hashmap. You will want to use '1'
> not '{plan_id => 1}'. The documentation should tell you what data type each
> call expects to be passed in.
>
>
> As for your last question, "Also I always get [Tue Sep 18 02:30:47 2007]
> [error] [client 127.0.0.1] Use of uninitialized value in pattern match (m//)
> at /usr/lib/perl5/site_perl/ 5.8.5/SOAP/Transport/HTTP.pm line 411. in the
> httod error log", this is a warning message. We have many of them on our
> servers. I wouldn't worry about it.
>
>
> I hope this helps.
>
>
>
>
>
> Jeff Dayley
> Intern Masters - Technical
> jeda...@novell.com
>
> Novell, Inc.
> SUSE(r) Linux Enterprise 10
> Your Linux is ready
> http://www.novell.com/linux
>
>
> >>> On Mon, Sep 17, 2007 at 4:30 AM, "Santos...@gmail.com"
> <Santos...@gmail.com> wrote:
>
>
> On Sep 17, 1:18 pm, "Santosh.Su...@gmail.com"
> <Santosh.Su...@gmail.com> wrote:
> > On Sep 14, 8:22 pm, "Vance Baarda" <V...@novell.com> wrote:
> >
> >
> >
> >
> >
> > > Please enter a bug against Testopia. Looks
> likehttp://lxr.mozilla.org/mozilla/source/webtools/testopia/testopia/patc...missing
> the code for ERROR_FAULT_SERVER.
> >
> > > Workaround -- add this to
> Bugzilla/WebService/Constants.pm, just after the definition
> of ERROR_GENERAL:
> > > # RPC Fault Code must be an integer
> > > use constant ERROR_FAULT_SERVER => 998;
> >
> > > Also, note that testopia does not yet support bugzilla 3.0.1
> (https://bugzilla.mozilla.org/show_bug.cgi?id=395958)
> >
> > > Regards,
> >
> > > Vance
> >
> > > >>> On 9/14/2007 at 12:58 AM, in message
> >
> > >
> <8d878f150709132358x5bd96ebcu9baa18905fc28...@mail.gmail.com>,
> "Santosh Sugur"
> >
> > > <santosh.su...@gmail.com> wrote:
> > > > Hi Mr Vance,
> >
> > > > Thanks for your reply. I used tr_xmlrpc.cgi this time and still get
> > > > the same 500 Internal Server Error. The httpd log shows
> >
> > > > [Fri Sep 14 16:04:46 2007] [error] [client 127.0.0.1] Use of
> > > > uninitialized value in pattern match (m//) at
> > > >> > my $proxy =
> XMLRPC::Lite->proxy("http://localhost/bugzilla-3.0.1/
> > > >> > xmlrpc.cgi");
> > > >> > my $soapresult = $proxy->call('TestPlan.get', {plan_id=>1});
> >
> > > >> > ---------------------
> > > >> > The last line fails. Is this all we need to write to get results? I
> > > >> > get this error on execution
> >
> > > >> > $ ./update_testopia.pl
> > > >> > 500 Internal Server Error at ./update_testopia.pl line 10
> > > >> > $
> >
> > > >> > I have also tried using the following code with the same results
> >
> > > >> > print XMLRPC::Lite
> > > >> >
> ->proxy("http://localhost/bugzilla-3.0.1/xmlrpc.cgi")
> > > >> > ->call('TestPlan.get',{plan_id=>1})
> > > >> > ->result;
> >
> > > >> > The httpd error log shows
> > > >> > [Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Use of
> > > >> > uninitialized value in pattern match (m//) at
> /usr/lib/perl5/site_perl/
> > > >> > 5.8.5/SOAP/Transport/HTTP.pm line 411.
> > > >> > [Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Use of
> > > >> > uninitialized value in pattern match (m//) at
> /usr/lib/perl5/site_perl/
> > > >> > 5.8.5/SOAP/Lite.pm line 2463.
> > > >> > [Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Undefined
> > > >> > subroutine
> &Bugzilla::WebService::Constants::ERROR_FAULT_SERVER called
> > > >> > at Bugzilla/WebService.pm line 113.
> > > >> > [Fri Sep 14 00:15:37 2007] [error] [client 127.0.0.1] Premature end
> of
> > > >> > script headers: xmlrpc.cgi
> >
> > > >> > The httpd access logs shows:
> > > >> > 127.0.0.1 - - [14/Sep/2007:00:15:35 +0530] "POST /bugzilla-3.0.1/
> > > >> > xmlrpc.cgi HTTP/1.1" 500 610 "-" "SOAP::Lite/Perl/0.69"
> >
> > > >> > I think this may be some configuration/trivial mistake on my part.
> I
> > > >> > am not sure if the URL we pass as proxy should include xmlrpc.cgi,
> but
> > > >> > without that I used to get an XML "mismatched tag" error.
> >
> > > >> > This is a bit urgent, can some one please give me a push here?
> >
> > > >> The Testopia CGI you want is tr_xmlrpc.cgi
> >
> > > >> The one you're using (xmlrpc.cgi) is for Bugzilla.
> >
> > > >> Regards,
> >
> > > >> Vance- Hide quoted text -
> >
> > > - Show quoted text -
> >
> > Thanks again! I have logged a bug as per your
> suggestionhttps://bugzilla.mozilla.org/show_bug.cgi?id=396399
> > How do I get the testplan details?
> >
> > Thanks and Regards,
> > Santosh- Hide quoted text -
> >
> > - Show quoted text -
>
> Addendum:
>
> If in the above code I print $soapresult using Data::Dumper I get a
> huge listing in which I also get the data I am interested in
>
>
> 'author_id' => '1',
> 'name'
> =>
> 'Sample_Test_plan_1',
>
> 'default_product_version' => 'unspecified',
>
> 'plan_id' => '1',
>
> 'product_id' =>
> '1',
>
> 'creation_date' =>
> '2007-09-17 23:38:30',
>
> 'type_id' => '8',
>
> 'isactive' => '1'
>
> How do I get just the hash map of key/value pairs for the result as
> said in the documentation?
>
> Also now in the above code in the call to TestPlan.get if I give
> {plan_id=>1} as the value instead of the only '1' I get the following:
> # ./update_testopia.pl
> 998 An internal error has occurred, but Bugzilla doesn't know
> what non-empty-hash means.
>
> If you are a Bugzilla end-user seeing this message, please save
> this page and send it to santos...@xxxxx.com. at ./
> update_testopia.pl line 35.
>
> Line 35 is die $soapresult->faultcode . ' ' . $soapresult-
> >faultstring;
>
> Which is the correct usage?
>
> Also I always get
> [Tue Sep 18 02:30:47 2007] [error] [client 127.0.0.1] Use of
> uninitialized value in pattern match (m//) at /usr/lib/perl5/site_perl/
> 5.8.5/SOAP/Transport/HTTP.pm line 411.
> in the httod error log
>
> I know I may be asking too many (dumb) questions, but I need to get
> this working. I really appreciate your help.
>
> Many Thanks,
> Santosh
>
>
> _______________________________________________
> support-webtools mailing list
> support-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/support-webtools
>
>
>