If you are a software/solutions developer, you might want to include the getAvailability service into your application.
This can be done by using the Web service method or by using the following HTTP request:
- http://vo.imcce.fr/webservices/ssodnet/getAvailability?[parameters]
where
[parameters] is a list of parameters separated by the character &.
The allowed parameters are:
Parameter | Definition | Limits |
mime=<string> |
Mime type of the results |
votable | html | text |
from=<string> |
Word which definite the name of the caller application, or which describes the request |
any short string (without space) |
The output is described in the following table and are available in
VOTable, HTML or plain text format
(cf. examples). The mime parameter is optionnal and its value can be omitted
(just write nothing or &mime= without value). In this case, the output is displayed in VOTable.
The SsoDNet Web service provides methods based on
SOAP and
HTTP POST verb which allow
one to interact between its own application and the SsoDNet service. Here is the useful information to
invoke the getAvailability method:
- Web Service URI:
- http://vo.imcce.fr/webservices/ssodnet/ssodnet.php
- Namespace:
- http://vo.imcce.fr/webservices/ssodnet
- WSDL:
- http://vo.imcce.fr/webservices/ssodnet/ssodnet.php?wsdl
- SOAP header:
- name of the SOAP header element: 'clientID'
- SOAP header's content: array('from' => 'YourName', 'hostip'=>'')
- Method:
- getavailability (mime)
The input parameter of the method is a string which provides the format of the output:
Variable | Type | Units | Limits or values | Default | Comment |
mime |
string |
- |
votable | html | text |
votable |
Mime type of the results |
The output parameters of the method is a string
which contains information which are conformed to the "availability 0.2" schema (IVOA Support Interfaces and Basic Profile):
No. | Definition | Value |
1 |
Availability |
'available', 'unavailable' |
2 |
Uptime: time since last restart of service |
duration |
3 |
ValidTo: next scheduled down-time, if known, nil=true if unknown |
dateTime (ISO format) |
4 |
ContactDetails: detailed contact |
string |
Depending on the selected mime type, the output is formatted as:
- votable
- the data are written in the IVOA standard VOTable format
- html
- the data are transformed in a HTML document using a XSLT processing (SsoDNet getAvailability XSL style sheet)
- text
- the data are returned in plain text where each value is separated by the pipe '|' character
Examples: click on the following links to get the status of the database with:
- mime=text
- mime=html
- mime=votable
You have two ways to use the SsoDNet web service: by writting a client to send requests to the SsoDNet server and to receive and analyze the response,
or by using a command line interface and a data transfert program such as curl or
wget. For that, just execute one of the following commands in a console:
#> curl "<URL>"
or
#> wget "<URL>"
where <URL> is described in section HTTP request.
In order to help you to invoke the SsoDNet web service, we provide some clients written in differents languages.
Here are some detailed explanations to see how to write a client with PHP and SOAP which invokes the getavailability method:
1/ Provide the input parameters which are mandatory for the service:
// Client's ID: provide the name of your project or organisation or yourself
$from = 'MyName';
// Input parameters
$param = array('mime' => "html");
2/ Define the SOAP options, the namespace and the WSDL URI of SsoDNet web service:
// Enables or disables the WSDL caching feature
ini_set('soap.wsdl_cache_enabled', 1);
// SsoDNet namespace
$namespace = 'http://vo.imcce.fr/webservices/ssodnet';
// SsoDNet WSDL
$uriwsdl = $namespace.'/ssodnet.wsdl';
3/ Create a SoapClient object in WSDL mode, set the SOAP header, then call the method and catch exceptions:
try
{
// Constructs the client
$client = new SoapClient($uriwsdl, array('exceptions'=>1, 'soap_version'=>"SOAP_1_2"));
// SOAP header
$header = array('from'=>$from, 'hostip'=>'');
$client->__setSoapHeaders(array(new SOAPHeader($namespace, 'clientID', $header)));
// Call the resolver method
$response = $client->__soapCall('getavailability', $param);
// Display the results
if ($param['mime'] == 'text')
{
header("Content-Type: text/plain");
$res = split(';', $response->result);
$nbr = count($res);
$key = array_keys($res);
for ($i=0; $i<$nbr; $i++) { echo $res[$key[$i]],"\n"; };
}
else
{
header("Content-Type: text/xml");
echo $response->result."\n";
}
}
catch (SoapFault $fault)
{
trigger_error("SOAP Fault: {$fault->getTraceAsString()} (faultcode: {$fault->faultcode}, faultstring: {$fault->faultstring})", E_USER_ERROR);
}