The following Web Services call may be used for this purpose:
/services/webservices/system/admin/resource/operations/testDataSourceConnection
Below is an example input to the Web Services call, to test a data source '/shared/examples/ds_inventory' :
Input:
<resource:testDataSourceConnection xmlns:resource="http://www.compositesw.com/services/system/admin/resource">
<resource:path>/shared/examples/ds_inventory</resource:path>
</resource:testDataSourceConnection>
If the test is successful, the output will return a SUCCESS status as shown below:
<resource:testDataSourceConnectionResponse xmlns:resource="http://www.compositesw.com/services/system/admin/resource"
xmlns:common="http://www.compositesw.com/services/system/util/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<resource:status>SUCCESS</resource:status>
<resource:messages/>
</resource:testDataSourceConnectionResponse>
If the test is unsuccessful, the output will be:
<resource:testDataSourceConnectionResponse xmlns:resource="http://www.compositesw.com/services/system/admin/resource" xmlns:common="http://www.compositesw.com/services/system/util/common" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<resource:status>FAIL</resource:status>
<resource:messages>
<common:message>The connection attempt failed.</common:message>
</resource:messages>
</resource:testDataSourceConnectionResponse>