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

valueof usage help needed

Expand Messages
  • Kamlesh
    I have this code. #!c: perl bin perl.exe -w use SOAP::Lite; use Data::Dumper; my $soap = SOAP::Lite - service
    Message 1 of 4 , May 6 9:47 PM
    • 0 Attachment
      I have this code.
      #!c:\perl\bin\perl.exe -w

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

      my $soap = SOAP::Lite
      ->service
      ('http://hdwebqa/arsys/WSDL/SJCappServer/UserLoginName');

      my $som = $soap->OpGet(SOAP::Data->name("Request_ID"
      => '000000000000002'));

      print $som->valueof('//Envelope/Body/OpGetResponse/Full_Name') ;
      print $som->valueof('//Envelope/Body/OpGetResponse/Email_Address');

      I know my wsdl works.
      But I don't know how to get the response back. There are 2 values
      returned back but I can't figure out how to use it.

      I am getting this error:

      Can't call method "valueof" without a package or object reference at
      C:\DOCUME~1\kp52r11\LOCALS~1\Temp\dir138.tmp\r3.pl line 13.

      CAN U HELP!!!
    • Alberto Accomazzi
      From what I can tell if you give SOAP::Lite a WSDL file to instantiate your SOAP object, it will deserialize the response into a hash (rather than returning a
      Message 2 of 4 , May 7 6:15 AM
      • 0 Attachment
        From what I can tell if you give SOAP::Lite a WSDL file to instantiate
        your SOAP object, it will deserialize the response into a hash (rather
        than returning a SOAP::SOM object). My guess is that this is a
        "feature" although it's not clear to me why things were done this way
        and if there is any workaround. Among other things, this becomes a
        problem if you want to check for a fault.

        To see the contents of the returned value, I suggest you do this:

        use Data::Dumper;
        my $hash = $soap->OpGet(SOAP::Data->name("Request_ID" =>
        '000000000000002'));
        print Data::Dumper->Dump([$hash]);


        -- Alberto


        > Date: Wed, 07 May 2003 04:47:59 -0000
        > From: "Kamlesh" <kp52r11@...>
        > Subject: valueof usage help needed
        >
        > I have this code.
        > #!c:\perl\bin\perl.exe -w
        >
        > use SOAP::Lite;
        > use Data::Dumper;
        >
        > my $soap = SOAP::Lite
        > ->service
        > ('http://hdwebqa/arsys/WSDL/SJCappServer/UserLoginName');
        >
        > my $som = $soap->OpGet(SOAP::Data->name("Request_ID"
        > => '000000000000002'));
        >
        > print $som->valueof('//Envelope/Body/OpGetResponse/Full_Name') ;
        > print $som->valueof('//Envelope/Body/OpGetResponse/Email_Address');
        >
        > I know my wsdl works.
        > But I don't know how to get the response back. There are 2 values
        > returned back but I can't figure out how to use it.
        >
        > I am getting this error:
        >
        > Can't call method "valueof" without a package or object reference at
        > C:\DOCUME~1\kp52r11\LOCALS~1\Temp\dir138.tmp\r3.pl line 13.

        ****************************************************************************
        Alberto Accomazzi
        NASA Astrophysics Data System http://adswww.harvard.edu
        Harvard-Smithsonian Center for Astrophysics http://cfa-www.harvard.edu
        60 Garden Street, MS 83, Cambridge, MA 02138 USA
        ****************************************************************************
      • Byrne Reese
        Try this: print $som- valueof( //OpGetResponse/Full_Name ) ; print $som- valueof( //OpGetResponse/Email_Address ); I know it is a little different than what
        Message 3 of 4 , May 7 8:34 AM
        • 0 Attachment
          Try this:
           
          print $som->valueof('//OpGetResponse/Full_Name')  ;
          print $som->valueof('//OpGetResponse/Email_Address');

          I know it is a little different than what you might expect considering how XPath works. But the root element of the SOAP Body is considered the ROOT element of the SOM object.
           
          -----Original Message-----
          From: Kamlesh [mailto:kp52r11@...]
          Sent: Tuesday, May 06, 2003 9:48 PM
          To: soaplite@yahoogroups.com
          Subject: [soaplite] valueof usage help needed

          I have this code.
          #!c:\perl\bin\perl.exe -w

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

            my $soap = SOAP::Lite
               ->service
          ('http://hdwebqa/arsys/WSDL/SJCappServer/UserLoginName');

            my $som = $soap->OpGet(SOAP::Data->name("Request_ID"
          => '000000000000002'));

          print $som->valueof('//Envelope/Body/OpGetResponse/Full_Name')  ;
          print $som->valueof('//Envelope/Body/OpGetResponse/Email_Address');

          I know my wsdl works.
          But I don't know how to get the response back.  There are 2 values
          returned back but I can't figure out how to use it.

          I am getting this error:

          Can't call method "valueof" without a package or object reference at
          C:\DOCUME~1\kp52r11\LOCALS~1\Temp\dir138.tmp\r3.pl line 13.

          CAN U HELP!!!




          To unsubscribe from this group, send an email to:
          soaplite-unsubscribe@yahoogroups.com



          Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
        • Duncan Cameron
          ... As Alberto points out, when using service() SOAP::Lite returns the actual result, not a SOM object. The way to get hold of the SOM object when using a
          Message 4 of 4 , May 7 12:22 PM
          • 0 Attachment
            On 2003-05-07 Alberto Accomazzi wrote:
            >> Date: Wed, 07 May 2003 04:47:59 -0000
            >> From: "Kamlesh" <kp52r11@...>
            >> Subject: valueof usage help needed
            >>
            >> I have this code.
            >> #!c:\perl\bin\perl.exe -w
            >>
            >> use SOAP::Lite;
            >> use Data::Dumper;
            >>
            >> my $soap = SOAP::Lite
            >> ->service
            >> ('http://hdwebqa/arsys/WSDL/SJCappServer/UserLoginName');
            >>
            >> my $som = $soap->OpGet(SOAP::Data->name("Request_ID"
            >> => '000000000000002'));
            >>
            >> print $som->valueof('//Envelope/Body/OpGetResponse/Full_Name') ;
            >> print $som->valueof('//Envelope/Body/OpGetResponse/Email_Address');
            >>
            >> I know my wsdl works.
            >> But I don't know how to get the response back. There are 2 values
            >> returned back but I can't figure out how to use it.
            >>
            >> I am getting this error:
            >>
            >> Can't call method "valueof" without a package or object reference at
            >> C:\DOCUME~1\kp52r11\LOCALS~1\Temp\dir138.tmp\r3.pl line 13.

            > From what I can tell if you give SOAP::Lite a WSDL file to instantiate
            >your SOAP object, it will deserialize the response into a hash (rather
            >than returning a SOAP::SOM object). My guess is that this is a
            >"feature" although it's not clear to me why things were done this way
            >and if there is any workaround. Among other things, this becomes a
            >problem if you want to check for a fault.
            >
            >To see the contents of the returned value, I suggest you do this:
            >
            >use Data::Dumper;
            >my $hash = $soap->OpGet(SOAP::Data->name("Request_ID" =>
            >'000000000000002'));
            >print Data::Dumper->Dump([$hash]);

            As Alberto points out, when using service() SOAP::Lite returns the actual
            result, not a SOM object. The way to get hold of the SOM object when
            using a service is

            $som = $soap->call;
            # with no parameters call() returns the result of the last call

            Regards,
            Duncan
          Your message has been successfully submitted and would be delivered to recipients shortly.