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

Re: [soaplite] Documentation of paramsout is incorrect

Expand Messages
  • Duncan Cameron
    ... I think that you are misinterpreting the docs. As you point out, it is the value of the parameter not its element name that is returned in both cases.
    Message 1 of 2 , May 24 10:19 AM
    • 0 Attachment
      On 2003-05-24 15:19:00 the_quark1 <quark@...> wrote:

      >And/or there's a bug. :)
      >
      >I'm trying to access the results of SOAP call by name, not just as an
      >array. The documentation to paramsout includes the following example
      >return:
      >
      > <mehodResponse>
      > <res1>name1</res1>
      > <res2>name2</res2>
      > <res3>name3</res3>
      > </mehodResponse>
      >
      >It then goes on to suggest:
      >
      > $paramout1 = ($r->paramsout)[0]; # gives you 'name2' also
      >
      >and then, later:
      >
      > $paramout1 = $paramsout[0]; # gives you 'res2', same as
      >($r->paramsout)[0]
      >
      >Both of these statements cannot be true: ($r->paramsout)[0] cannot
      >return both 'name2' and 'res2' in a scalar context. In my
      >experiments, it clearly returns 'name2.' For that matter, every way
      >of calling paramsout seems to return the value, not the name. Is
      >there any way to get at the name short of parsing it myself?
      >
      I think that you are misinterpreting the docs. As you point out, it
      is the value of the parameter not its element name that is returned
      in both cases. Maybe the docs should be updated tho'.

      If you want access to the name and the type of elements then you'll
      need to use the SOM object, see the SOAP::SOM section

      $som->match('/Envelope/Body/[1]'); # match method
      $som->dataof('[1]'); # result
      $som->dataof('[2]'); # first out parameter (if present)

      etc.

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