[MOBY-guts] biomoby commit

Eddie Kawas kawas at dev.open-bio.org
Mon Feb 25 18:26:16 UTC 2008


kawas
Mon Feb 25 13:26:16 EST 2008
Update of /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi
In directory dev.open-bio.org:/tmp/cvs-serv13813/Perl/MOBY-Server/share/cgi

Modified Files:
	ServicePingerValidator 
Log Message:
added some xml validation when services are pinged.
moby-live/Perl/MOBY-Server/share/cgi ServicePingerValidator,1.1,1.2
===================================================================
RCS file: /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/ServicePingerValidator,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/ServicePingerValidator	2008/02/21 00:21:27	1.1
+++ /home/repository/moby/moby-live/Perl/MOBY-Server/share/cgi/ServicePingerValidator	2008/02/25 18:26:16	1.2
@@ -85,19 +85,36 @@
 						my $soap = shift;
 						my $res  = shift;
 						print "<pre>      " . $auth . "," . $name . " ~ is dead:\n</pre><br/>$res<br/>";
-						next;
 					}
 				  );
 
 				my $input = &_empty_input();
 				my $out   =
 				  $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result;
+				# validate the XML if we get a response
+				my $good_xml = 1;
+				do {
+					eval {
+					        my $parser  = XML::LibXML->new();
+					        $parser->parse_string($out);
+					};
+					$good_xml = 0 if $@;
+				} if $out;
+				  
 				do {
 					$out =~ s/&/&amp;/g;
                     $out =~ s/>/&gt;/g;
                     $out =~ s/</&lt;/g;
 					print "<pre>     " . $auth . "," . $name . " isAlive.\n     output:\n$out</pre><br/>";
-				} if $out;
+				} if $out and $good_xml;
+				
+				do {
+					$out =~ s/&/&amp;/g;
+                    $out =~ s/>/&gt;/g;
+                    $out =~ s/</&lt;/g;
+					print "<pre>     " . $auth . "," . $name . " isAlive but produced invalid XML.\n     output:\n$out</pre><br/>";
+				} if $out and not $good_xml;
+				
 				do {
 					print "<pre>     " . $auth . "," . $name . " ~ did not respond!</pre><br/>";
 				} unless $out;
@@ -140,19 +157,36 @@
 						my $soap = shift;
 						my $res  = shift;
 						print "<pre>      " . $auth . "," . $name . " ~ is dead:\n</pre><br/>$res<br/>";
-						next;
 					}
 				  );
 
 				my $input = &_empty_input();
 				my $out   =
 				  $soap->$name( SOAP::Data->type( 'string' => "$input" ) )->result;
+				# validate the XML if we get a response
+				my $good_xml = 1;
+				do {
+					eval {
+					        my $parser  = XML::LibXML->new();
+					        $parser->parse_string($out);
+					};
+					$good_xml = 0 if $@;
+				} if $out;
+				
 				do {
 					$out =~ s/&/&amp;/g;
                     $out =~ s/>/&gt;/g;
                     $out =~ s/</&lt;/g;
 					print "<pre>     " . $auth . "," . $name . " isAlive.\n     output:\n$out</pre><br/>";
-				} if $out;
+				} if $out and $good_xml;
+				
+				do {
+					$out =~ s/&/&amp;/g;
+                    $out =~ s/>/&gt;/g;
+                    $out =~ s/</&lt;/g;
+					print "<pre>     " . $auth . "," . $name . " isAlive but produced invalid XML.\n     output:\n$out</pre><br/>";
+				} if $out and not $good_xml;
+				
 				do {
 					print "<pre>     " . $auth . "," . $name . " ~ did not respond!</pre><br/>";
 				} unless $out;




More information about the MOBY-guts mailing list