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

Re: [soaplite] Need Help parsing returned data on perl client (again, sorry)

Expand Messages
  • Duncan Cameron
    ... You probably want return %Soapdata; When you pass a hash to a function, it can t tell that it was a hash as opposed to a list or array. ... SOAP::Lite has
    Message 1 of 2 , Aug 20 2:09 PM
    • 0 Attachment
      On 2002-08-19 ripperx007 wrote:
      >Hello,
      >
      >I am trying to return a hash to a client
      >from a cgi perl soap server. I am trying
      >just a simple hash with only 2 values for
      >testing.
      >
      >-------------------------------------------
      ># data i am trying to return
      >
      >%Soapdata = undef ;
      >
      >$Soapdata{1}="First hash value" ;
      >$Soapdata{2}="Second hash value" ;
      >
      >return %Soapdata ;

      You probably want

      return \%Soapdata;

      When you pass a hash to a function, it can't tell that it was a hash
      as opposed to a list or array.
      >
      >__________________________________________
      >
      >I can see the data in the XML output when I run
      >the client script in trace mode.
      >
      ><s-gensym7 xsi:type="xsd:int">1</s-gensym7>
      ><s-gensym9 xsi:type="xsd:string">First Hash value</s-gensym9>
      ><s-gensym11 xsi:type="xsd:int">2</s-gensym11>
      ><s-gensym13 xsi:type="xsd:string">Second Hash value</s-gensym13>
      >
      SOAP::Lite has serialised your hash as a list of 4 values.

      >__________________________________________
      >
      >But I cannot figure out how to parse it on the client end.
      >I am using a perl client. I have researched most of the
      >SOAP resources includine this mail group and still have
      >no luck. Rather than confuse things with what I have
      >tried could somebody please help with some quick code
      >that would just get me started. I am just beginning to research
      >SOAP and love programming in perl and wanted to see what
      >all the hoopla was all about.
      >

      Not sure what it is that you've tried and don't understand.
      See the SOAP::Lite docs which have lots of simple examples.
      The result() method gives you the first (possibly only) returned
      value. In your case it should be a hash reference.

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