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

Documentation of paramsout is incorrect

Expand Messages
  • the_quark1
    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
    Message 1 of 2 , May 24, 2003
    • 0 Attachment
      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?

      Regardless of the solution to my problem, that's clearly an error in
      the documentation, and I'd argue that whole section is pretty muddled,
      since it gives a number of examples which return 'res#' outputs, none
      of which do in my tests. I'd rewrite it, but I'm not sure whether the
      incorrect items should be removed, or if there *is* a way to get
      'res#' as an output...

      Does anyone know how to do this, if it's possible?

      Thanks..

      Brett
    • 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 2 of 2 , May 24, 2003
      • 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.