WSDiscovery: workaround for SOAP::WSDL QName limitation

This commit is contained in:
Jan M. Hochstein 2016-04-16 19:06:36 +02:00
parent 8b92151a0c
commit 5d3f5e5a4a
2 changed files with 51 additions and 3 deletions

View File

@ -7,8 +7,10 @@ __PACKAGE__->_set_element_form_qualified(0);
sub get_xmlns { 'http://schemas.xmlsoap.org/ws/2005/04/discovery' };
our $XML_ATTRIBUTE_CLASS;
undef $XML_ATTRIBUTE_CLASS;
our $XML_ATTRIBUTE_CLASS = 'WSDiscovery10::Types::ProbeType::_ProbeType::XmlAttr';
#our $XML_ATTRIBUTE_CLASS;
#undef $XML_ATTRIBUTE_CLASS;
sub __get_attr_class {
return $XML_ATTRIBUTE_CLASS;
@ -49,11 +51,55 @@ __PACKAGE__->_factory(
} # end BLOCK
package WSDiscovery10::Types::ProbeType::_ProbeType::XmlAttr;
#use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
use Class::Std::Fast::Storable constructor => 'none', cache => 1;
use base qw(SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType);
{ # BLOCK to scope variables
my %Attribs_of :ATTR(:get<Attribs>);
sub new
{
my $self = pop @{ Class::Std::Fast::OBJECT_CACHE_REF()->{ $_[0] } };
$self = bless \(my $o = Class::Std::Fast::ID()), $_[0]
if not defined $self;
$self->BUILD(${$self}, $_[1]);
return $self;
}
sub BUILD
{
my ($self, $ident, $arg_ref) = @_;
$Attribs_of{$ident} = $arg_ref;
}
# without this no attributes are serialized
# SOAP::WSDL::XSD::Typelib::CompexType sub serialize_attr()
sub as_bool :BOOLIFY { 1 }
sub serialize()
{
my $ident = ${ $_[0] };
my $option_ref = $_[1];
my $attr_str = "";
foreach my $attr (keys %{$Attribs_of{$ident}})
{
my $value = %{$Attribs_of{$ident}}{$attr};
$attr_str .= " $attr=\"$value\"";
}
return $attr_str;
}
} # end BLOCK
1;

View File

@ -212,7 +212,9 @@ sub discover
$result = $svc_discover->ProbeOp(
{ # WSDiscovery::Types::ProbeType
Types => 'http://www.onvif.org/ver10/network/wsdl:NetworkVideoTransmitter http://www.onvif.org/ver10/device/wsdl:Device', # QNameListType
xmlattr => { 'xmlns:dn' => 'http://www.onvif.org/ver10/network/wsdl',
'xmlns:tds' => 'http://www.onvif.org/ver10/device/wsdl', },
Types => 'dn:NetworkVideoTransmitter tds:Device', # QNameListType
Scopes => { value => '' },
},
WSDiscovery10::Elements::Header->new({