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

RE: [soaplite] How to build a complex data structure?

Expand Messages
  • Byrne Reese
    The following answer is also posted on the SOAP::Lite solutions-blog-thing-a-ma-jig: http://www.majordojo.com/archives/2003_04.html#000011
    Message 1 of 3 , Apr 29, 2003
    • 0 Attachment
      The following answer is also posted on the SOAP::Lite solutions-blog-thing-a-ma-jig:
       
       
      In short:
       

      The following code snippet shows how to specify an additional namespace. It is easy - in fact anytime you need to specify additional attributes for an XML element in SOAP::Lite, just use the SOAP::Data->attr() subroutine like so:

      my $method = SOAP::Data->name('methodName')
                      ->attr({'xmlns:ns2' => 'urn:SecondaryNamespace'})
                      ->prefix('ns1')
                      ->uri('urn:PrimaryNamespace');
      my $params = SOAP::Data->name('param' => '123');
      my $results = $search->call($method => $params);
      -----Original Message-----
      From: Alan D. Salewski [mailto:salewski@...]
      Sent: Tuesday, April 29, 2003 5:12 AM
      To: soaplite@yahoogroups.com
      Subject: Re: [soaplite] How to build a complex data structure?

      On Tue, Apr 29, 2003 at 11:32:41AM -0000, Torsten Mangner spake thus:
      > Hi Folks,
      >
      > i have to send input arguments for a soap-function in the following
      > structure:
      > <customers>
      >   <customer>
      >     <no>1001</no>
      >   </customer>
      >   <customer>
      >     <no>1002</no>
      >   </customer>
      >   .
      >   .
      >   .
      > </customers>
      >
      > Now i got no idea, how to build up a structure like these with "SOAP::
      > Data->"-stuff.
      > May someone of you experts can help me.
      >
      > thanks in advance,
      > torsten

      Hi Torsten,

      You could try something like the following:

         my $arg = SOAP::Data->name('customers')
                             ->value([SOAP::Data->name('customer')
                                                ->value(SOAP::Data->name('no')
                                                                  ->value(1001)
                                                       ),
                                      SOAP::Data->name('customer')
                                                ->value(SOAP::Data->name('no')
                                                                  ->value(1002)
                                                       ),
                                      SOAP::Data->name('customer')
                                                ->value(SOAP::Data->name('no')
                                                                  ->value(1003)
                                                       )
                                      ]);

         my $result = $soap->somefunction($arg);

      You can check the list archives for other examples.

      HTH,

      -Al

      --
      a l a n   d.   s a l e w s k i             salewski@...
      --------------------------------------------------------------------
      We have realized a fantastically bleeding edge modular authoring
                                     tool.
      --------------------------------------------------------------------
      Generated from WWW Marketing Phrase gizmo:   www.lyra.org/phrase.cgi


      To unsubscribe from this group, send an email to:
      soaplite-unsubscribe@yahoogroups.com



      Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
    Your message has been successfully submitted and would be delivered to recipients shortly.