MOBY
view release on metacpan or search on metacpan
share/cgi/ServicePingerValidator view on Meta::CPAN
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/&/&/g;
$out =~ s/>/>/g;
$out =~ s/</</g;
print "<pre> " . $auth . "," . $name . " isAlive.\n output:\n$out</pre><br/>";
} if $out and $good_xml;
do {
$out =~ s/&/&/g;
$out =~ s/>/>/g;
$out =~ s/</</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;
}
$| = $old;
} else {
print "Content-type: text/html\n\n";
print &GENERATE_FORM();
}
sub _empty_input {
return <<'END_OF_XML';
<?xml version="1.0" encoding="UTF-8"?>
<moby:MOBY xmlns:moby="http://www.biomoby.org/moby">
<moby:mobyContent>
</moby:mobyContent>
</moby:MOBY>
END_OF_XML
}
sub GENERATE_FORM {
my $values = "";
my $m = MOBY::Client::Central->new();
my @URIs = $m->retrieveServiceProviders();
foreach my $uri (@URIs) {
next if $uri eq '127.0.0.1';
$values .= "<option value='$uri'>$uri</option>\n"
}
my $msg =<<EOF;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test your services!</title>
<style type="text/css">
<!--
body {
background: #ffffcd;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12pt;
font-weight: normal;
margin-top: 110px;
margin-right: 1em;
margin-bottom: 1em;
margin-left: 1em;
background-position: left top;
background-repeat: no-repeat;
}
.indent {
margin-left: 5em;
}
.hidden {
visibility:hidden;
}
.visible {
visibility:visible;
}
iframe {
width:100%;
height:300px;
background:#FFDC75 none repeat scroll 0%;
font-family:sans-serif,Tahoma,Arial;
text-align:left;
}
td.text {
background: #ffffcd;
color: #000000;
font-family: Arial, Helvetica, sans-serif;
font-size: 12pt;
font-weight: normal;
margin-top: 110px;
margin-right: 1em;
margin-bottom: 1em;
margin-left: 1em;
}
h1 {
border: solid;
text-align:center;
background-color:yellow;
color: navy;
}
h2 {
border: ridge;
padding: 5px;
background-color:yellow;
color: navy;
}
( run in 1.604 second using v1.01-cache-2.11-cpan-bbe5e583499 )