takeos has asked for the wisdom of the Perl Monks concerning the following question:
I was tired of writing a large complex data with plain SOAP::Data and was so glad to have found SOAP::Data::ComplexType, but I couldn't make a soap array with it. I tried to do exactly as the sample code does but the sample didn't even compile and I had to modify it a bit.
I was expecting output like#!C:/perl/bin/perl -w use strict; use SOAP::Data::ComplexType; package My::Complex; use base qw(SOAP::Data::ComplexType); use constant OBJ_TYPE => 'myns:complex'; use constant OBJ_URI => 'http://my.uri.com'; use constant OBJ_FIELDS => { string_array => [ 'SOAP-ENC:Array', undef, { 'SOAP-ENC:arrayType' => 'string +' } ] }; sub new { my $proto = shift; my $class = ref($proto) || $proto; my $data = shift; my $obj_fields = $_[1]; #second param from untouched @_ $obj_fields = defined $obj_fields && ref($obj_fields) eq 'HASH' ? +{%{+OBJ_FIELDS}, %{$obj_fields}} : OBJ_FIELDS; my $self = $class->SUPER::new($data, $obj_fields); return bless($self, $class); } my $complex = My::Complex->new({string_array => [ 'text1', 'text2', 't +ext3' ]}); print $complex->as_xml_data;
but all I got was three <string_array>s. I'm using SOAP::Data::ComplexType 0.044 running on ActivePerl. Please tell me what kind of mistake I've made...<string_array type="xsi:SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string +[3]"> <item xsi:type="xsd:string">text1</item> <item xsi:type="xsd:string">text2</item> <item xsi:type="xsd:string">text3</item> </string_array>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: SOAP array construction with SOAP::Data::ComplexType
by erroneousBollock (Curate) on Nov 19, 2007 at 13:39 UTC | |
by takeos (Initiate) on Nov 20, 2007 at 01:35 UTC | |
by erroneousBollock (Curate) on Nov 20, 2007 at 02:04 UTC | |
by takeos (Initiate) on Nov 20, 2007 at 05:53 UTC |
Back to
Seekers of Perl Wisdom