Subject: | XMLRPC::Lite does not support serializing <nil/> |
Meanwhile I was testing an XML-RPC service which allows <nil/> as parameter, I realized XMLRPC::Lite does not support serializing them. I tried using undef values a parameter, but they were silently discarded, so the service complained about the number of parameters.
Digging into the XMLRPC::Lite and SOAP::Lite source codes, I realized that a patch to gain <nil/> serialization is as easy as implementing xmlize method on XMLRPC::Serializer:
package XMLRPC::Serializer;
sub xmlize {
my $self = shift;
my($name, $attrs, $values, $id) = @{$_[0]};
$attrs ||= {};
return $self->SUPER::xmlize(@_) if(defined($values));
local $self->{_level} = $self->{_level} + 1;
return $self->tag($name, $attrs,$self->tag('nil'));
}