#!/usr/bin/perl -w

use SOAP::Lite;
use Data::Dumper;

my $bugz_login = 'a.michetti@gmail.com';
my $bugz_password = '123456';
my $test_bug_number = 1;
my $soap_cgi_file_url = 'http://safedevel.icmc.usp.br/~michetti/bugs/soap.cgi';


$client = SOAP::Lite->new();

# Set the URI.
#
# For example, if in the SOAP server you have something like this:
# my $response = Bugzilla::WebService::SOAP::Transport::HTTP::CGI
#    ->dispatch_with({'Bugzilla' => 'Bugzilla::WebService::Bugzilla',
#                     'Bug'      => 'Bugzilla::WebService::Bug',
#                     'User'     => 'Bugzilla::WebService::User',
#                     'Product'  => 'Bugzilla::WebService::Product',
#                    })
#    ->handle();
#
# The ->uri should be set to 'Bugzilla', 'Bug', 'User' or 'Product'
# Actualy, this will be the value of the SOAPAction
$client->uri('User');

# The URL of the SOAP server
$client->proxy($soap_cgi_file_url);
           
# Call the login function
my $response = $client->login($bugz_login, $bugz_password);

# Get Bugzilla Version
$client->uri('Bugzilla');
$response = $client->get_version();
print "* Bugzilla Version: " . $response->result() . "\n";

# Get a Bug
$client->uri('Bug');
$response = $client->get_bug($test_bug_number);
print "* Bug Information: \n" . Dumper($response->result()) . "\n";

# Call the logout function
$client->uri('User');
$response = $client->logout();
