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

Yet Another Serialization question

Expand Messages
  • bill_rayburn@yahoo.com
    Hi, I m trying to generate this in the SOAP body: Joe Momma joemomma
    Message 1 of 5 , Oct 11, 2001
    • 0 Attachment
      Hi,

      I'm trying to generate this in the SOAP body:

      <newUser>
      <firstname>Joe</firstname>
      <lastname>Momma</lastname>
      <userid>joemomma</jmomma>
      <associatedDevices>
      <device>SEP222222222248</device>
      <device>SEP222222222249</device>
      </associatedDevices>
      </newUser>

      It's actually the parameter to a method call, which
      I'm omitting for brevity.

      I've gotten this far, but I want to know if I'm going
      down the right track:

      (SOAP::Data->name('newUser'))->type('ordered_hash' => [
      'firstname' => 'Joe',
      'lastname' => 'Momma',
      'userid' => 'joemomma',
      'associatedDevices' =>
      ['SEP222222222248', 'SEP222222222249'],
      ])

      The resulting body looks close, but I don't know how to specify the
      <device> tags.

      And why would I want to build the <newUser> element this way instead
      of using type('xml')? I could build methods on my objects that
      returned strings of xml -- what would be the downside to that?

      Thanks,
      Bill
    • Chris Davies
      I m sure Paul will correct me, but I think you wrap the array elements in a SOAP::Data- name chunk, something like this: associatedDevices = [
      Message 2 of 5 , Oct 11, 2001
      • 0 Attachment
        I'm sure Paul will correct me, but I think you wrap the array elements in a
        SOAP::Data->name chunk, something like this:

        'associatedDevices' => [
        SOAP::Data->name('device')->value('SEP222222222248'),
        SOAP::Data->name('device')->value('SEP222222222249')
        ]

        I would suggest that in response to the second question, deciding whether to
        use type('xml') or not depends on whether you want your application or the
        SOAP layer to unravel your structure. My understanding is that type('xml')
        is treated as an opaque object by the SOAP layer, and it just passes it
        though unchanged.

        Chris


        -----Original Message-----
        From: bill_rayburn@... [mailto:bill_rayburn@...]
        Sent: Thursday, October 11, 2001 9:48 AM
        To: soaplite@yahoogroups.com
        Subject: [soaplite] Yet Another Serialization question

        I'm trying to generate this in the SOAP body:
        [...]
        <associatedDevices>
        <device>SEP222222222248</device>
        <device>SEP222222222249</device>
        </associatedDevices>
        [...]

        The resulting body looks close, but I don't know how to specify the
        <device> tags.

        And why would I want to build the <newUser> element this way instead
        of using type('xml')? I could build methods on my objects that
        returned strings of xml -- what would be the downside to that?
        [...]
      • Paul Kulchenko
        Hi, Chris! ... You re right. Side effect of this method is that associatedDevices element will contain arrayType attribute, which is not always feasible. As
        Message 3 of 5 , Oct 11, 2001
        • 0 Attachment
          Hi, Chris!

          --- Chris Davies <Chris.Davies@...> wrote:
          > I'm sure Paul will correct me, but I think you wrap the array
          > elements in a
          > SOAP::Data->name chunk, something like this:
          >
          > 'associatedDevices' => [
          > SOAP::Data->name('device')->value('SEP222222222248'),
          > SOAP::Data->name('device')->value('SEP222222222249')
          > ]
          You're right. Side effect of this method is that 'associatedDevices'
          element will contain arrayType attribute, which is not always
          feasible. As alternative ordered_hash could be used, that allow you
          to generate any names without using arrays on wire:

          associatedDevices => SOAP::Data->type(ordered_hash => [
          device => 'SEP222222222248',
          device => 'SEP222222222249',
          ])

          > SOAP layer to unravel your structure. My understanding is that
          > type('xml')
          > is treated as an opaque object by the SOAP layer, and it just
          > passes it though unchanged.
          That's my understanding too ;)

          Best wishes, Paul.


          __________________________________________________
          Do You Yahoo!?
          Make a great connection at Yahoo! Personals.
          http://personals.yahoo.com
        • bill_rayburn@yahoo.com
          Thanks guys. That method seems so obvious now. I admit, I got tired of thinking. Bill
          Message 4 of 5 , Oct 11, 2001
          • 0 Attachment
            Thanks guys. That method seems so obvious now.

            I admit, I got tired of thinking.

            Bill

            --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > Hi, Chris!
            >
            > --- Chris Davies <Chris.Davies@M...> wrote:
            > > I'm sure Paul will correct me, but I think you wrap the array
            > > elements in a
            > > SOAP::Data->name chunk, something like this:
            > >
            > > 'associatedDevices' => [
            > > SOAP::Data->name('device')->value('SEP222222222248'),
            > > SOAP::Data->name('device')->value('SEP222222222249')
            > > ]
            > You're right. Side effect of this method is that 'associatedDevices'
            > element will contain arrayType attribute, which is not always
            > feasible. As alternative ordered_hash could be used, that allow you
            > to generate any names without using arrays on wire:
            >
            > associatedDevices => SOAP::Data->type(ordered_hash => [
            > device => 'SEP222222222248',
            > device => 'SEP222222222249',
            > ])
          • Chris Davies
            It wasn t obvious to me when I started with SOAP::Lite. I think I must have asked similar questions a few months ago. I find searching the archives really
            Message 5 of 5 , Oct 12, 2001
            • 0 Attachment
              It wasn't obvious to me when I started with SOAP::Lite. I think I must have
              asked similar questions a few months ago. I find searching the archives
              really quite useful, as Paul always comes back with a helpful response.

              Regards,
              Chris

              -----Original Message-----
              From: bill_rayburn@... [mailto:bill_rayburn@...]
              Sent: Thursday, October 11, 2001 8:14 PM
              To: soaplite@yahoogroups.com
              Subject: [soaplite] Re: Yet Another Serialization question


              Thanks guys. That method seems so obvious now.

              I admit, I got tired of thinking.

              Bill
            Your message has been successfully submitted and would be delivered to recipients shortly.