Fixed WS-Discovery Probe message header
This commit is contained in:
parent
2125faa444
commit
edf3f3c43a
|
@ -0,0 +1,55 @@
|
|||
|
||||
package WSDiscovery10::Elements::Header;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
__PACKAGE__->_set_element_form_qualified(0);
|
||||
|
||||
sub get_xmlns { 'http://schemas.xmlsoap.org/soap/envelope/' };
|
||||
|
||||
our $XML_ATTRIBUTE_CLASS;
|
||||
undef $XML_ATTRIBUTE_CLASS;
|
||||
|
||||
sub __get_attr_class {
|
||||
return $XML_ATTRIBUTE_CLASS;
|
||||
}
|
||||
|
||||
use Class::Std::Fast::Storable constructor => 'none';
|
||||
use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
|
||||
|
||||
Class::Std::initialize();
|
||||
|
||||
{ # BLOCK to scope variables
|
||||
|
||||
my %Action_of :ATTR(:get<Action>);
|
||||
my %MessageID_of :ATTR(:get<MessageID>);
|
||||
my %ReplyTo_of :ATTR(:get<ReplyTo>);
|
||||
my %To_of :ATTR(:get<To>);
|
||||
|
||||
__PACKAGE__->_factory(
|
||||
[ qw( Action MessageID ReplyTo To ) ],
|
||||
{
|
||||
'Action' => \%Action_of,
|
||||
'MessageID' => \%MessageID_of,
|
||||
'ReplyTo' => \%ReplyTo_of,
|
||||
'To' => \%To_of,
|
||||
},
|
||||
{
|
||||
'Action' => 'WSDiscovery10::Elements::Action',
|
||||
'MessageID' => 'WSDiscovery10::Elements::MessageID',
|
||||
'ReplyTo' => 'WSDiscovery10::Elements::ReplyTo',
|
||||
'To' => 'WSDiscovery10::Elements::To',
|
||||
},
|
||||
{
|
||||
'Action' => '',
|
||||
'MessageID' => '',
|
||||
'ReplyTo' => '',
|
||||
'To' => '',
|
||||
}
|
||||
);
|
||||
|
||||
} # end BLOCK
|
||||
|
||||
|
||||
1;
|
|
@ -25,10 +25,10 @@ our $typemap_1 = {
|
|||
'ProbeMatches/ProbeMatch/EndpointReference/ReferenceProperties' => 'WSDiscovery10::Types::ReferencePropertiesType',
|
||||
'ProbeMatches/ProbeMatch/EndpointReference/PortType' => 'WSDiscovery10::Types::AttributedQName'
|
||||
'MessageID' => 'WSDiscovery10::Elements::MessageID',
|
||||
'RelatesTo' => '__SKIP__',
|
||||
'To' => '__SKIP__',
|
||||
'Action' => '__SKIP__',
|
||||
'AppSequence' => '__SKIP__',
|
||||
'RelatesTo' => 'WSDiscovery10::Elements::RelatesTo',
|
||||
'To' => 'WSDiscovery10::Elements::To',
|
||||
'Action' => 'WSDiscovery10::Elements::Action',
|
||||
'AppSequence' => 'WSDiscovery10::Elements::AppSequence',
|
||||
};
|
||||
;
|
||||
|
||||
|
|
|
@ -25,13 +25,14 @@
|
|||
#
|
||||
|
||||
use Getopt::Std;
|
||||
use Data::UUID;
|
||||
|
||||
require ONVIF::Client;
|
||||
|
||||
require WSDiscovery10::Interfaces::WSDiscovery::WSDiscoveryPort;
|
||||
require WSDiscovery10::Elements::Header;
|
||||
require WSDiscovery10::Elements::Types;
|
||||
require WSDiscovery10::Elements::Scopes;
|
||||
require WSDiscovery10::Elements::To;
|
||||
|
||||
require WSDiscovery::TransportUDP;
|
||||
|
||||
|
@ -169,6 +170,8 @@ sub discover
|
|||
## try both soap versions
|
||||
my %services;
|
||||
|
||||
my $uuid_gen = Data::UUID->new();
|
||||
|
||||
if($verbose) {
|
||||
print "Probing for SOAP 1.1\n"
|
||||
}
|
||||
|
@ -177,12 +180,18 @@ sub discover
|
|||
});
|
||||
$svc_discover->set_soap_version('1.1');
|
||||
|
||||
my $uuid = $uuid_gen->create_str();
|
||||
|
||||
my $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
|
||||
Scopes => { value => '' },
|
||||
},
|
||||
WSDiscovery10::Elements::To->new({ value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' })
|
||||
WSDiscovery10::Elements::Header->new({
|
||||
Action => { value => 'http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe' },
|
||||
MessageID => { value => "urn:uuid:$uuid" },
|
||||
To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' },
|
||||
})
|
||||
);
|
||||
# print $result . "\n";
|
||||
|
||||
|
@ -197,12 +206,20 @@ sub discover
|
|||
});
|
||||
$svc_discover->set_soap_version('1.2');
|
||||
|
||||
# copies of the same Probe message must have the same MessageID.
|
||||
# This is not a copy. So we generate a new uuid.
|
||||
$uuid = $uuid_gen->create_str();
|
||||
|
||||
$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
|
||||
Scopes => { value => '' },
|
||||
},
|
||||
WSDiscovery10::Elements::To->new({ value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' })
|
||||
WSDiscovery10::Elements::Header->new({
|
||||
Action => { value => 'http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe' },
|
||||
MessageID => { value => "urn:uuid:$uuid" },
|
||||
To => { value => 'urn:schemas-xmlsoap-org:ws:2005:04:discovery' },
|
||||
})
|
||||
);
|
||||
# print $result . "\n";
|
||||
|
||||
|
|
Loading…
Reference in New Issue