Keith Brown > SOAP > SOAP::Struct

Download:
SOAP-0.28.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Module Version: 0.28   Source  

NAME ^

SOAP::Struct - support for ordered hashes

SYNOPSIS ^

use SOAP::EnvelopeMaker;

# produce a body that will retain the order of params # when serialized to a SOAP envelope my $body = SOAP::Struct->new( a => 3, b => 4, );

# same as above, but explicit xsi:type attrs will also # be included for accessor 'b' my $body = SOAP::Struct->new_typed( a => 3, undef, b => 4, 'float', );

DESCRIPTION ^

The SOAP spec explicitly mandates that it should be possible to serialize structures and control both the names of the accessors and the order that they appear in the serialized stream. (SOAP 1.1, section 7.1, bullet 3) Prior to SOAP/Perl 0.25, this was impossible, as the only way to serialize a "struct" was to use a hash, which is unordered in Perl. This class allows you to specify a structure where the order of the accessors is preserved. This is important when making SOAP calls to many traditional RPC-style servers that expect parameters to arrive in a certain order (and could generally care less about the names of those parameters).

new(accessor_1_name => accessor_1_value, ...)

This constructor feels the same as constructing a hash, but the order of the accessors will be maintained when this "super-hash" is serialized.

new_typed(accessor_1_name => accessor_1_value, accessor_1_type, ...)

This constructor is for convenience - if you pass something other than undef for accessor_n_type, then accessor_n_value will be wrapped with a TypedPrimitive class with the specified type. This way you can force explicit type names to be used for each element in the structure. See SOAP::TypedPrimitive for a discussion of why this can be important.

DEPENDENCIES ^

SOAP::TypedPrimitive

AUTHOR ^

Keith Brown

SEE ALSO ^

SOAP::TypedPrimitive

syntax highlighting: