| 1 | package Net::Journyx::SOAP::Encoding; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | use base 'XML::Compile::SOAP'; | ||
| 6 | |||
| 7 | sub _dec_typed { | ||
| 8 | my ($self, $node, $type, $index) = @_; | ||
| 9 | |||
| 10 | my ($prefix, $local) = $type =~ m/^(.*?)\:(.*)/ ? ($1, $2) : ('',$type); | ||
| 11 | return (shift)->SUPER::_dec_typed(@_) unless $prefix eq 'jxapi'; | ||
| 12 | |||
| 13 | # warn "manually decoding $type"; | ||
| 14 | |||
| 15 | my %res = (); | ||
| 16 | my @childs = grep $_->isa('XML::LibXML::Element'), $node->childNodes; | ||
| 17 | foreach my $children ( @childs ) { | ||
| 18 | my $name = $children->nodeName; | ||
| 19 | # warn "decoding $name of $type"; | ||
| 20 | if ( $name eq 'id' ) { | ||
| 21 | $res{'_id'} = $self->_dec([$children], '', 0, 1); | ||
| 22 | } else { | ||
| 23 | $res{$name} = $self->_dec([$children], '', 0, 1); | ||
| 24 | } | ||
| 25 | } | ||
| 26 | |||
| 27 | return { $local => \%res }; | ||
| 28 | } | ||
| 29 | |||
| 30 | 1; |