I have a generic IP camera that uses the ONVIF "protocol". The connection to it via YYP2P (android app) is working, however I can not connect to the onvif-java-lib library. Code I'm using:
import java.net.ConnectException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.soap.SOAPException;
import de.onvif.soap.OnvifDevice;
public class Main {
public static void main(String[] args) {
try {
OnvifDevice nvt = new OnvifDevice("192.168.15.215:554"); //abre a conexão com a câmera
Date nvtDate = nvt.getDevices().getDate(); //Armazena a data
System.out.println(new SimpleDateFormat().format(nvtDate)); //imprime a data
}
catch (ConnectException e) {
System.err.println("Could not connect to NVT.");
}
catch (SOAPException e) {
System.err.println(e.getMessage());
}
}
}
When I run the program, the console prints:
Request SOAP Message (GetCapabilities): <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Header/><env:Body><GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"/></env:Body></env:Envelope>
Since it is not an error message, it is not giving an error, but the program is in an infinite loop and does not print the date (it is stopped at the connection line). If anyone knows how to solve or know another library for the same purpose, help pfv. Thank you in advance.
NOTE: I already tried to use the most complete OnvifDevice nvt = new OnvifDevice("192.168.15.215:554", "Root", "123");
form and tried the users (root, root, admin and admin) with password 123 (default and password that was connecting in the android application) and it did not work. p>
NOTE: I have already updated the camera firmware tbm.