Subject: | Invalid XML in OpenSRS renew response causes XML parser exception. |
While testing renewals using the OpenSRS test system I got an exception
from the XML parser in make_request complaining that the name of one of
the XML elements (registration expiration date) in the response for the
renew operation contains spaces. Converting the spaces to underscores
fixes the problem.
Subject: | Net-OpenSRS.traceback.txt |
not well-formed (invalid token) at line 5, column 27, byte 142 at /usr/lib/perl5/XML/Parser.pm line 187
Trace begun at /usr/share/perl5/HTML/Mason/Exceptions.pm line 129
HTML::Mason::Exceptions::rethrow_exception('^Jnot well-formed (invalid token) at line 5, column 27, byte 142 at /usr/lib/perl5/XML/Parser.pm line 187^J') called at /usr/share/perl/5.8/Carp.pm line 102
Carp::croak('^Jnot well-formed (invalid token) at line 5, column 27, byte 142') called at /usr/lib/perl5/XML/Parser/Expat.pm line 478
XML::Parser::Expat::parse('XML::Parser::Expat=HASH(0xb83b48c)', '<opt>^J <admin_email>nobody@example.com</admin_email>^J <auto_renew>0</auto_renew>^J <order_id>1058226</order_id>^J <registration expiration date>2015-05-15 19:22:24</registration expiration date>^J</opt>^J') called at /usr/lib/perl5/XML/Parser.pm line 187
eval {...} at /usr/lib/perl5/XML/Parser.pm line 186
XML::Parser::parse('XML::Parser=HASH(0xb6d49a4)', '<opt>^J <admin_email>nobody@example.com</admin_email>^J <auto_renew>0</auto_renew>^J <order_id>1058226</order_id>^J <registration expiration date>2015-05-15 19:22:24</registration expiration date>^J</opt>^J') called at /usr/share/perl5/XML/SAX/Expat.pm line 60
XML::SAX::Expat::_parse_string('XML::SAX::Expat=HASH(0xb8713b8)', '<opt>^J <admin_email>nobody@example.com</admin_email>^J <auto_renew>0</auto_renew>^J <order_id>1058226</order_id>^J <registration expiration date>2015-05-15 19:22:24</registration expiration date>^J</opt>^J') called at /usr/share/perl5/XML/SAX/Base.pm line 2602
XML::SAX::Base::parse('XML::SAX::Expat=HASH(0xb8713b8)', 'HASH(0xb84c488)') called at /usr/share/perl5/XML/SAX/Base.pm line 2655
XML::SAX::Base::parse_string('XML::SAX::Expat=HASH(0xb8713b8)', '<opt>^J <admin_email>nobody@example.com</admin_email>^J <auto_renew>0</auto_renew>^J <order_id>1058226</order_id>^J <registration expiration date>2015-05-15 19:22:24</registration expiration date>^J</opt>^J') called at /usr/share/perl5/XML/Simple.pm line 370
XML::Simple::build_tree('XML::Simple=HASH(0xb84c2f0)', undef, 'SCALAR(0xb86dff4)') called at /usr/share/perl5/XML/Simple.pm line 308
XML::Simple::build_simple_tree('XML::Simple=HASH(0xb84c2f0)', undef, 'SCALAR(0xb86dff4)') called at /usr/share/perl5/XML/Simple.pm line 270
XML::Simple::parse_string('XML::Simple=HASH(0xb84c2f0)', 'SCALAR(0xb86dff4)') called at /usr/share/perl5/XML/Simple.pm line 171
XML::Simple::XMLin('<opt>^J <admin_email>nobody@example.com</admin_email>^J <auto_renew>0</auto_renew>^J <order_id>1058226</order_id>^J <registration expiration date>2015-05-15 19:22:24</registration expiration date>^J</opt>^J') called at /usr/local/share/perl/5.8.8/Net/OpenSRS.pm line 1175
Net::OpenSRS::make_request('Net::OpenSRS=HASH(0xb3b8ac4)', 'HASH(0xb3c02a8)') called at /usr/local/share/perl/5.8.8/Net/OpenSRS.pm line 961
Net::OpenSRS::renew_domain('Net::OpenSRS=HASH(0xb3b8ac4)', 'example.com', 1) called at /usr/local/share/perl/5.8.8/FS/part_export/domreg_opensrs.pm line 461
Subject: | OpenSRS.pm.diff |
--- OpenSRS.pm.orig 2006-04-08 22:26:22.000000000 +0000
+++ OpenSRS.pm 2009-06-14 22:07:32.000000000 +0000
@@ -1159,7 +1159,10 @@
my $struct;
if ( $res->is_success ) {
$self->debug("HTTP result: " . $res->status_line);
- eval { $struct = XML::Simple::XMLin( $res->content); };
+ my $rslt = $res->content;
+ # OpenSRS renew response triggers parser error due to spaces in element name
+ $rslt =~ s/registration expiration date/registration_expiration_date/g;
+ eval { $struct = XML::Simple::XMLin( $rslt ); };
if ($self->debug_level > 1) {
$self->debug("\nOpenSRS Response XML:\n" . '-' x 30);