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