SOAP::Serializer

SOAP::Serializer does not need to be used directly except when autotyping is enabled. It allows you to specify types for your data.

You can specify a type with SOAP::Data, with code similar to the following:

SOAP::Data->type(something => [ ... ])

When serialization is reached, SOAP::Lite will attempt to serialize your data with the as_something method, if such a method exists. If you don’t create an as_something method, no serialization will occur. You can create as_something with the following:

sub SOAP::Serializer::as_something {
	my $self = shift;
	my($key, $val) = @_;
	...
	return [$key, {'xsi:type' => 'xsd:something', %attr}, $val];
}

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.