0

I am reading data from our Jira via SOAP and recieve an array of RemoteIssue-Objects. Now I want to iterate over these and get the status of each ticket. The documentation of RemoteIssue says that there is a getStatus()-Method. When I call it on the objects my program throws an error.

Some code:

my $soap = SOAP::Lite->uri($soap_uri)->proxy($soap_proxy);
my $login = $soap->login( $soap_user, $soap_password)->result;

if ($login) {
    # This works
    my $issues = $soap->getIssuesFromJqlSearch( $login, "project = \"$project\" AND fixVersion = \"$project_version\"", 500 );

    if ($issues) {
        foreach my $issue (@{$issues->result}) {
            my $foo = $issue->getStatus(); # This doesn't work
            print Dumper $foo;
        }
    }
}
$soap->logout();

The thrown error:

Can't locate object method "getStatus" via package "RemoteIssue" at D:\ZeuS\lib/ZeuS.pm line 81

Every other object method doesn't work either.

Does anyone know what I am doing wrong?

Demnogonis
  • 3,172
  • 5
  • 31
  • 45

1 Answers1

1

From what I gather, you're under the impression that you're receiving the Java object that you would manipulate on a Java consumer.

Unless $issue->getStatus() is a SOAP call (which I don't think it is) you're not dealing with the API, you're dealing with SOAP::Lite's representation in Perl of the response in XML.

getIssuesFromJqlSearch seems to be the remote call. From that, you should get $issues as a SOAP::SOM object. Which you then properly address with the result method.

This will have whatever methods are defined for the class this object is blessed into.

To see what all this object responds to try this:

use mro ();
use Scalar::Util qw<blessed>;
...
    foreach my $issue (@{$issues->result}) {
        say '$issue ISA ('
          . join( ',', @{ mro::get_linear_isa( blessed( $issue )) } )
          . ')'
          ;
          ...
    }

$issue will only have those methods that have been defined for it on the Perl side.

  • NOTE: It is not clear from your code where ZeuS.pm comes into this thing.
Axeman
  • 29,660
  • 2
  • 47
  • 102
  • ZeuS.pm is the module where the code comes from. Ok, looks like I completely missunderstood the usage of SOAP::Lite. Thanks for the explanation. – Demnogonis May 31 '12 at 12:39
  • Ok. I read a bit more documentation about SOAP::Lite, but I still can't figure out how to use the methods of a returned object. Could you help me eventually? – Demnogonis Jun 04 '12 at 07:54