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

1229RE: [soaplite] nested elements in Body...

Expand Messages
  • Taras Shkvarchuk
    Feb 11, 2002
    • 0 Attachment
      When constructing the body use references instead
      my $body=SOAP::Data->name("getHoroscope" =>
      \SOAP::Data->name("astrology"=>\SOAP::Data->name("sign"=>"libra")));

      this gives you:
      <SOAP-ENV:Body>
      <getHoroscope>
      <astrology>
      <sign xsi:type="xsd:string">libra</sign>
      </astrology>
      </getHoroscope>
      </SOAP-ENV:Body>

      > -----Original Message-----
      > From: Byrne Reese
      > Sent: Monday, February 11, 2002 1:10 PM
      > To: Duncan Cameron
      > Cc: SOAP Lite Mailing List
      > Subject: Re: [soaplite] nested elements in Body...
      >
      >
      > 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/encodi
      > ng/" 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
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~-->
      > Sponsored by VeriSign - The Value of Trust
      > When building an e-commerce site, you want to start with a
      > secure foundation. Learn how with VeriSign's FREE Guide.
      > http://us.click.yahoo.com/kWSNbC/XdiDAA/yigFAA/W6uqlB/TM
      > --------------------------------------------------------------
      > -------~->
      >
      > 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/
    • Show all 10 messages in this topic