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

Re: removing c-gensym3

Expand Messages
  • Byrne Reese
    First I might point you to the following article... it does take you through how to construct these structures manually, but it also discusses the annoying
    Message 1 of 2 , Jan 14, 2004
    • 0 Attachment
      First I might point you to the following article... it does take you
      through how to construct these structures manually, but it also
      discusses the annoying gensym elements:

      http://builder.com.com/5100-6389-1045078-2.html

      SOAP::Data::Builder may also help you:
      http://search.cpan.org/~teejay/SOAP-Data-Builder-0.6/lib/SOAP/Data/Builder.pm

      I tried a fewer other things hoping to get rid of the gensym, but
      SOAP::Lite's serializer simply isn't cut out for this kind of thing -
      yet. It is possible to override SOAP::Lite Serializer though... but
      you don't want to have to do that.

      I found a way to do this for my wsdl2perl utility (still unfinished),
      but I didn't re-write the serializer... I simply created serializers
      for each type I wanted to serialize and it worked rather well:

      I am posting this code in the off chance that you see something you
      can use...

      BEGIN {

      package MySerializer;

      sub as__Product {
      my $self = shift;
      my ($value, $name, $type, $attr) = @_;
      return [
      $name,
      {'xsi:type' => 'Product', %$attr},
      [ map {
      my $name = $_;
      $name =~ s/^_//;
      $self->encode_object($value->{$_},
      $name,
      $types->{'Product/'.$name});
      } keys %$value ]
      ];
      }


      }

      --- In soaplite@yahoogroups.com, "nib000" <mwatson@p...> wrote:
      > Hi,
      >
      > I'm trying to put together complex (atleast in my view) bit of xml
      > using soaplite, with this
      >
      > my @soap_data = (
      > SOAP::Data->name(
      > 'XXX' => \SOAP::Data->value(
      > SOAP::Data->new(name => 'number',value => '2000'),
      > SOAP::Data->new(name => 'name',value => 'bob'),
      > )
      > ),
      > SOAP::Data->name(
      > 'YYY' => \SOAP::Data->value(
      > SOAP::Data->new(name => 'bla',value => $bla),
      > )
      > )
      > );
      >
      > which all works fine, except I dont really want to have to construct
      > it like this
      > for every service, would rather be able to just give SOAP::Data a
      > hashref/array and
      > it be able to piece it today, and it ALMOST can,
      >
      > my @data = {
      > XXX => { number => '2000',
      > name => 'bob',
      > },
      > YYY => { bla => $bla }
      > };
      > my $soap_data = \SOAP::Data->name(\@data);
      >
      > almost gives me what I want, except I end up with this, the problem
      > being the c-gensym3,
      >
      > <ServiceName xmlns="http://xxxxxxx">
      > <c-gensym3>
      > <YYY>
      > <bla>value of bla</bla>
      > </YYY>
      > <XXX>
      > <name>bob</name>
      > <number>2000</number>
      > </XXX>
      > </c-gensym3>
      > </ServiceName>
      >
      > from
      > google, I guess the impression that this is due to me passing an
      > anonymous array. Anyway
      > I can get around this, without having to actually contruct each little
      > bit of SOAP::Data myself?
      >
      > Thanks
      > Regards,
      > Matt Watson.
    Your message has been successfully submitted and would be delivered to recipients shortly.