This commit is contained in:
Isaac Connor 2020-05-12 15:47:44 -04:00
parent f8249251bd
commit 8f3a8ee877
1 changed files with 7 additions and 10 deletions

View File

@ -33,15 +33,15 @@ use ONVIF::Deserializer::MessageParser;
use SOAP::WSDL::Factory::Deserializer; use SOAP::WSDL::Factory::Deserializer;
SOAP::WSDL::Factory::Deserializer->register('1.1', __PACKAGE__ ); SOAP::WSDL::Factory::Deserializer->register('1.1', __PACKAGE__);
SOAP::WSDL::Factory::Deserializer->register('1.2', __PACKAGE__ ); SOAP::WSDL::Factory::Deserializer->register('1.2', __PACKAGE__);
## we get the soap version from the message parser ## we get the soap version from the message parser
my %soap_version_of :ATTR( :default<()>); my %soap_version_of :ATTR( :default<()>);
sub soap_version { sub soap_version {
my ($self) = @_; my ($self) = @_;
if($SOAP::WSDL::Deserializer::XSD::parser_of{ident $self}) { if ( $SOAP::WSDL::Deserializer::XSD::parser_of{ident $self} ) {
return $SOAP::WSDL::Deserializer::XSD::parser_of{ident $self}->soap_version(); return $SOAP::WSDL::Deserializer::XSD::parser_of{ident $self}->soap_version();
} }
return ''; return '';
@ -51,7 +51,7 @@ sub deserialize {
my ($self, $content) = @_; my ($self, $content) = @_;
my $parser = $SOAP::WSDL::Deserializer::XSD::parser_of{ ${ $self } }; my $parser = $SOAP::WSDL::Deserializer::XSD::parser_of{ ${ $self } };
if(not $parser) { if ( not $parser ) {
$parser = ONVIF::Deserializer::MessageParser->new({ $parser = ONVIF::Deserializer::MessageParser->new({
strict => $SOAP::WSDL::Deserializer::XSD::strict_of{ ${ $self } } strict => $SOAP::WSDL::Deserializer::XSD::strict_of{ ${ $self } }
}); });
@ -60,8 +60,8 @@ sub deserialize {
$parser->class_resolver( $parser->class_resolver(
$self->SOAP::WSDL::Deserializer::XSD::get_class_resolver() ); $self->SOAP::WSDL::Deserializer::XSD::get_class_resolver() );
eval { $parser->parse_string( $content ) }; eval { $parser->parse_string($content) };
if ($@) { if ( $@ ) {
return $self->generate_fault({ return $self->generate_fault({
code => 'SOAP-ENV:Server', code => 'SOAP-ENV:Server',
role => 'urn:localhost', role => 'urn:localhost',
@ -78,12 +78,9 @@ sub generate_fault {
return SOAP::WSDL::SOAP::Typelib::Fault11->new({ return SOAP::WSDL::SOAP::Typelib::Fault11->new({
faultcode => $args_from_ref->{ code } || 'SOAP-ENV:Client', faultcode => $args_from_ref->{ code } || 'SOAP-ENV:Client',
faultactor => $args_from_ref->{ role } || 'urn:localhost', faultactor => $args_from_ref->{ role } || 'urn:localhost',
faultstring => $args_from_ref->{ message } || "Unknown error" faultstring => $args_from_ref->{ message } || 'Unknown error'
}); });
} }
1; 1;
__END__ __END__