Loading ...
Sorry, an error occurred while loading the content.
 

Re: [soaplite] Can't call method on an undefined value ???

Expand Messages
  • Paul Kulchenko
    Hi, Jon! ... you don t need to call - result() here. When you call - result() method it returns result of the method call, which is undef in this case. Just
    Message 1 of 3 , May 23, 2002
      Hi, Jon!

      > my $som = $soap->LookitUp(
      ... skipped
      > )->result;

      you don't need to call ->result() here. When you call ->result()
      method it returns result of the method call, which is undef in this
      case. Just leave it out and you'll get a SOM object you may work
      with.

      Best wishes, Paul.

      --- jonthorwilliams <jonthorwilliams@...> wrote:
      > my SOAP::Lite 0.55 script throws this error, and i cannot figure
      > out
      > why. can anyone make a guess? it implies that my SOM object is
      > not
      > defined??? how can this be?
      >
      > "Can't call method "match" on an undefined value at
      > C:\Temp\findcommunity.pl line 27."
      >
      > BTW, The returned envelope is empty, and looks like this:
      > <?xml version="1.0" encoding="UTF-8" standalone="no"?><soap-
      > env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/enve
      > lope/" soap-
      > env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:namesp1="sURL"><soap-env:Header/><soap-env:Bo
      > dy><namesp1:ReturnAllResponse/></soap-env:Body></soap-env:Envelope>
      >
      > ----------------------------------------
      > #!perl -w
      >
      > use strict;
      > use SOAP::Lite +'trace';
      >
      > my $soap = SOAP::Lite
      > -> uri('http://www.awebservice.com')
      > -> proxy('http://localhost:8080/'); # proxy to MSSoapTrace
      >
      > my $som = $soap->LookitUp(
      > SOAP::Header->name('TargeSiteUrl')->type(string =>
      > '1.1.1.1'),
      > SOAP::Header->name('Token')->type(string => 'FakeToken'),
      > SOAP::Header->name('TargetSitePort')->type(string =>
      > '9088'),
      > SOAP::Data->name('Scope')->type(string => 'LocalOnly'),
      > SOAP::Data->name('World')->type(string => '6'),
      > SOAP::Data->name('Type')->type(string => 'Community'),
      > SOAP::Data->name('ConId')->type(string => '2'),
      > SOAP::Data->name('Action')->type(string => 'ReturnAll'),
      > SOAP::Data->name('Public')->type(string => 'true'),
      > SOAP::Data->name('Client')->type(string => 'JAXM Test App'),
      > SOAP::Data->name('Cat')->type(string => '1559'),
      > SOAP::Data->name('TSGZ')->type(string => 'false'),
      > )->result;
      >
      > print "\n-----\n";
      >
      > if ($som->match(SOAP::SOM::envelope)) {
      > $som->valueof('Header'); # should give access to header if
      > present
      > $som->valueof('Body'); # should give access to body
      > } else {
      > print "nothing here";
      > }
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      LAUNCH - Your Yahoo! Music Experience
      http://launch.yahoo.com
    • jonthorwilliams
      I got stuck trying to print out values from the SOM object. I cant seem to get any of the SOM methods to print correctly, except for result and
      Message 2 of 3 , May 23, 2002
        I got stuck trying to print out values from the SOM object. I cant
        seem to get any of the SOM methods to print correctly, except
        for "result" and "namespaceuriof()". here is a completely working
        SOAP::Lite script as an example. can you say what is wrong with it?
        more specifically why cant i get proper results from the valueof,
        dataof, attr, and paramsout methods???

        ----------------------------

        #!perl -w

        use strict;
        use SOAP::Lite +'trace';

        my $soap = SOAP::Lite
        -> uri('/examples')
        -> on_action(sub { sprintf '"%s"', shift })
        -> proxy('http://superhonker.userland.com/');

        my $som = $soap->getStateName(
        SOAP::Header->name('MyHeader')->type(string => 'Value'),
        SOAP::Data->name(statenum => 49)
        );

        print "\n-----\n";

        if ($som->match(SOAP::SOM::envelope)) {
        print "Header=".$som->valueof('Header')."\n";
        print "Body=".$som->valueof('Body')."\n";
        print "First Body Value=".($som->body)[0]."\n";
        print "Res=".$som->result."\n";
        print "NS=".$som->namespaceuriof('Body')."\n";
        my $trans = $som->dataof;
        print "Attr Test=".$trans->attr."\n";
        print "ParamsOut=".$som->paramsout()."\n";

        } else {
        print "nothing here\n";
        }

        ----------------------------


        jon
      Your message has been successfully submitted and would be delivered to recipients shortly.