Solved

Can't call method "saveGeck" on unblessed reference at talk2serive.pl line 16

Posted on 2011-03-02
5
475 Views
Last Modified: 2012-05-11
Why do I get the this error when I run my script with the following command:

perl talk2service.pl 333333 '>>now submitting these files'

Open in new window


Can't call method "saveGeck" on unblessed reference at talk2serive.pl line 16

This is my code:

#!/usr/bin/perl -w

use strict;
use Data::Dumper;

# declare usage of SOAP::Lite
use SOAP::Lite;
my $submittedFiles = pop @ARGV;
foreach my $geckID (@ARGV) {
  
my $ssc = SOAP::Lite
  -> service('SOME_DOMAIN/main/services/MyWebService?wsdl')
  -> getGeck($geckID, 'tolgar');
  print Dumper $ssc;
  $ssc->{'solution'} .= $submittedFiles;
   $ssc->saveGeck($geckID, 'tolgar');
}

Open in new window


When I change line 16 with this one:

saveGeck($geckID, 'tolgar');

Open in new window


Now I get this error:

Undefined subroutine &main::saveGeck called at talk2service.pl line 16.


AND, this is how $ssc looks like:

$VAR1 = {
          'geckId' => '333333',
          'solution' => 'SOME TEXT',
          'geckStates' => [
                          bless( {
                                   'status' => 'Completed',
                                   'codedOn' => undef
                                 }, 'GeckState' )
                        ]
        };

Open in new window

0
Comment
Question by:Tolgar
  • 3
  • 2
5 Comments
 

Author Comment

by:Tolgar
ID: 35020322
Also,
if I change line 16 with this one:

-> saveGeck($ssc, 'tolgar');

Open in new window


Then I get this error:

syntax error at talk2service.pl line 16, near "-> saveGeck"
Execution of talk2service.pl aborted due to compilation errors.


0
 
LVL 26

Accepted Solution

by:
wilcoxon earned 500 total points
ID: 35020582
getGeck and saveGeck are functions of your web service, correct?

This will partly fix your problem.  I'm pretty sure you need to call saveGeck with the service definition (now stored in $svc) but I'm not sure how to get the contents of $ssc into saveGeck.
#!/usr/bin/perl

use strict;
use warnings
use SOAP::Lite;
use Data::Dumper;

my $submittedFiles = pop @ARGV;
foreach my $geckID (@ARGV) {
    my $svc = SOAP::Lite->service('SOME_DOMAIN/main/services/MyWebService?wsdl');
    my $ssc = $svc->getGeck($geckID, 'tolgar');
    print Dumper $ssc;
    $ssc->{'solution'} .= $submittedFiles;
    # something is almost definitely missing here
    # I'm not sure how to get the $ssc values back into saveGeck
    $svc->saveGeck($geckID, 'tolgar');
}

Open in new window

0
 

Author Comment

by:Tolgar
ID: 35021032
Now it does not return any error but it also does not put anything in the solution field. However, I wanted to append the new text into this fileld.

#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;
use SOAP::Lite;

my $myFiles = pop @ARGV;
foreach my $geckID (@ARGV) {
  
my $ssc = SOAP::Lite
  -> service('SOME_DOAMIN/main/services/MyWebService?wsdl');
  my $geck = $ssc-> getGeck($geckID, 'tolgar');
  $geck->{'solution'} .= $myFiles;
  $ssc-> saveGeck($geck, 'tolgar'); 
}

Open in new window



This is how I call this file:

perl talk2service.pl 333333 '>>>>now appending'

Open in new window


I expected .= to append but it basically does nothing.


Do you have any idea?

Thanks,
0
 
LVL 26

Expert Comment

by:wilcoxon
ID: 35021064
At this point, I think the issue is with you specific web service.  saveGeck should have some way of passing the structure back that you want to save (or else there is another function in your web service for doing the update and saveGeck just commits the save permanently).

Do you have documentation and examples for your web service that you can look through and figure out how to do the updating?
0
 

Author Comment

by:Tolgar
ID: 35021137
You are right. I am investigating it.

Thanks for your help,
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now