3.5.4.1 Java

The OvmWsSoapClient class provides a method to handle server discovery. This method simply requires the serverName or IP address, a text string containing the agentPassword and a boolean value to determine whether or not Oracle VM Manager should take ownership of the server:

...
@Override
    public Job serverDiscover(final String serverName, 
        final String agentPassword, final boolean takeOwnership) 
        throws WsException
    {
        try
        {
            return api.serverDiscover(serverName, agentPassword, takeOwnership);
        }
        catch (final WsException_Exception ex)
        {
            throw convertException(ex);
        }
    }

The WSDevClient class, in the sample code, does not include an example of server discovery, however to do server discovery, the code in your main class might look as follows:

final Job serverCreateJob = api.serverDiscover(
    "1.example.com", "p4ssword", true);
System.out.println("create server job id: " + serverCreateJob.getId());
sid=waitForJobComplete(api, serverCreateJob, Server.class);

Note that the SOAP response returned by the API contains information about the job that has been created to carry out the process requested. This is why we use the output from the serverDiscover method to populate a Job object. Using this object, you can easily track job status with the waitForJobComplete method, which also returns the server ID object if the job is successful.