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

Examples of parsing arrays and lists?

Expand Messages
  • Dean Johnson
    Hi, I feel like this is a lame question but I m having trouble getting this going and am having no luck finding an example. My client request is an array of
    Message 1 of 2 , Oct 31, 2002
    • 0 Attachment
      Hi,

      I feel like this is a lame question but I'm having trouble getting
      this going and am having no luck finding an example. My client
      request is an array of items and the server response is a matching
      list with data sent as attribtes.

      Am I doing something the hard way? I'm building both client and
      server and can change any of the communication.

      Can someone point me to an example that translates this kind of
      input/output?

      Thanks for any pointers!

      yours, Dean
      --

      Client:
      -------
      my @parameters = (
      SOAP::Data->name(mojo => [1..3]),
      );

      yields:

      <?xml version="1.0" encoding="UTF-8"?>
      <SOAP-ENV:Envelope ...snip...>
      <SOAP-ENV:Body>
      <namesp5:byname xmlns:namesp5="urn:/Parameters">
      <mojo SOAP-ENC:arrayType="xsd:int[3]" xsi:type="SOAP-ENC:Array">
      <item xsi:type="xsd:int">1</item>
      <item xsi:type="xsd:int">2</item>
      <item xsi:type="xsd:int">3</item>
      </mojo>
      </namesp5:byname>
      </SOAP-ENV:Body></SOAP-ENV:Envelope>

      Server:
      -------
      foreach $i (1..3) {
      push (@response,
      SOAP::Data->new(name => 'mojo')->attr ( {
      number => $i,
      id => 'a',
      op => '12345',
      type => 'voodoo'
      } ) );
      }

      yields:

      <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope ...snip...>
      <namesp1:mojo_serviceResponse xmlns:namesp1="urn:Random">
      <mojo op="12345" id="a" type="voodoo" number="1"/>
      <mojo op="12345" id="a" type="voodoo" number="2"/>
      <mojo op="12345" id="a" type="voodoo" number="3"/>
      </namesp1:mojo_serviceResponse>
      </SOAP-ENV:Body></SOAP-ENV:Envelope>
    • Paul Kulchenko
      Hi Dean, Don t see a reason why this wouldn t work, but why don t you want to deal with usual arrays and hashes. You may want to look here for one example on
      Message 2 of 2 , Oct 31, 2002
      • 0 Attachment
        Hi Dean,

        Don't see a reason why this wouldn't work, but why don't you want to
        deal with usual arrays and hashes. You may want to look here for one
        example on how to deal with them:
        http://guide.soaplite.com/#handling%20lols%20(list%20of%20lists,%20structs,%20objects,%20or%20something%20else)

        Best wishes, Paul.

        --- Dean Johnson <irontiki@...> wrote:
        > Hi,
        >
        > I feel like this is a lame question but I'm having trouble getting
        > this going and am having no luck finding an example. My client
        > request is an array of items and the server response is a matching
        > list with data sent as attribtes.
        >
        > Am I doing something the hard way? I'm building both client and
        > server and can change any of the communication.
        >
        > Can someone point me to an example that translates this kind of
        > input/output?
        >
        > Thanks for any pointers!
        >
        > yours, Dean
        > --
        >
        > Client:
        > -------
        > my @parameters = (
        > SOAP::Data->name(mojo => [1..3]),
        > );
        >
        > yields:
        >
        > <?xml version="1.0" encoding="UTF-8"?>
        > <SOAP-ENV:Envelope ...snip...>
        > <SOAP-ENV:Body>
        > <namesp5:byname xmlns:namesp5="urn:/Parameters">
        > <mojo SOAP-ENC:arrayType="xsd:int[3]"
        > xsi:type="SOAP-ENC:Array">
        > <item xsi:type="xsd:int">1</item>
        > <item xsi:type="xsd:int">2</item>
        > <item xsi:type="xsd:int">3</item>
        > </mojo>
        > </namesp5:byname>
        > </SOAP-ENV:Body></SOAP-ENV:Envelope>
        >
        > Server:
        > -------
        > foreach $i (1..3) {
        > push (@response,
        > SOAP::Data->new(name => 'mojo')->attr ( {
        > number => $i,
        > id => 'a',
        > op => '12345',
        > type => 'voodoo'
        > } ) );
        > }
        >
        > yields:
        >
        > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
        > ...snip...>
        > <namesp1:mojo_serviceResponse xmlns:namesp1="urn:Random">
        > <mojo op="12345" id="a" type="voodoo" number="1"/>
        > <mojo op="12345" id="a" type="voodoo" number="2"/>
        > <mojo op="12345" id="a" type="voodoo" number="3"/>
        > </namesp1:mojo_serviceResponse>
        > </SOAP-ENV:Body></SOAP-ENV:Envelope>
        >
        >
        > ------------------------ 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!?
        HotJobs - Search new jobs daily now
        http://hotjobs.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.