Skip to content

Commit

Permalink
WSDiscovery: workaround for SOAP::WSDL QName limitation
Browse files Browse the repository at this point in the history
  • Loading branch information
altaroca committed Apr 16, 2016
1 parent 8b92151 commit 5d3f5e5
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
50 changes: 48 additions & 2 deletions onvif/proxy/lib/WSDiscovery10/Types/ProbeType.pm
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 3 additions & 1 deletion onvif/scripts/zmonvif-probe.pl
Expand Up @@ -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({
Expand Down

0 comments on commit 5d3f5e5

Please sign in to comment.