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

1228Re: [soaplite] nested elements in Body...

Expand Messages
  • Byrne Reese
    Feb 11, 2002
      That did work a little better, however, as a user I grow concerned when
      I see things serialized in ways different than the example I see posted
      on a Web services HTML page.

      For example,
      $body = { "astrology" => { 'sign' => $SIGN } };

      $soap = SOAP::Lite
      ->uri('urn:vgx-horoscope')
      ->on_action(sub { sprintf "%s",'urn:vgx-horoscope' })
      ->proxy("$URL")
      ->getHoroscope($body);

      Gets serialized into:

      <SOAP-ENV:Envelope xmlns:namesp2="http://xml.apache.org/xml-soap" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
      <SOAP-ENV:Body>
      <namesp1:getHoroscope xmlns:namesp1="urn:vgx-horoscope">
      <c-gensym3 xsi:type="namesp2:SOAPStruct">
      <astrology xsi:type="namesp2:SOAPStruct">
      <sign xsi:type="xsd:string">aries</sign>
      </astrology>
      </c-gensym3>
      </namesp1:getHoroscope>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>

      I just want to get rid of "c-gensyn3" - unless of course this is just
      SOAP serializing the data and I can be assured that it will be
      deserialized properly...

      I agree the 'astrology' element is useless, but it is what the service
      calls for. :(



      On Mon, 2002-02-11 at 12:56, Duncan Cameron wrote:
      > On 2002-02-11 Byrne Reese wrote:
      > >There *must* be a way to do this more intuitively...
      > >
      > >I want to create a simple SOAP::Data struct which will serialize into
      > >this:
      > >
      > ><getHoroscope>
      > > <astrology>
      > > <sign>foo</sign>
      > > </astrology>
      > ></getHoroscope>
      > >
      > >Here is my code:
      > >
      > >$body = SOAP::Data->name('astrology' => SOAP::Data->name('sign' => $SIGN)
      > > ->type('string') );
      > This *seems* more intuitive:
      >
      > my $body = {'astrology' => {'sign' => 'aries'} };
      >
      > >It makes sense to me that if SOAP::Lite will properly serialize perl
      > >arrays and hashes, it should serialize nested scalars.
      > >
      > I think that the docs need to be clearer about exactly where a SOAP::Data
      > object can go. For example, is it valid to nest them as you have tried?
      > In your case the first one ('astrology') is unnecessary as it doesn't add
      > anything.
      >
      > Regards,
      > Duncan Cameron
      >
      --
      :/ byrne

      breese@...
      (415) 544-7732
    • Show all 10 messages in this topic