我正在開發網絡視頻接口論壇Java項目,並按照ONVIF Application Programmer's Guide中描述的步驟進行操作。從Open ONVIF(網絡視頻接口論壇)設備錄製問題
我已經從ONVIF網站提供的wsdls
生成了源代碼。我可以使用media.wsdl
檢索實時流URI。現在我遇到了錄製問題。我已經嘗試過的代碼在下面給出:
RecordingService recording_ervice = new RecordingService();
RecordingPort record_port = recording_ervice.getRecordingPort();
BindingProvider bindingProvider = (BindingProvider) record_port;
// Add a security handler for the credentials
final Binding binding = bindingProvider.getBinding();
List<Handler> handlerList = binding.getHandlerChain();
if (handlerList == null) {
handlerList = new ArrayList<Handler>();
}
handlerList.add(new RecordStream.SecurityHandler());
// binding.setHandlerChain(handlerList);
// Set the actual web services address instead of the mock service
Map<String, Object> requestContext = bindingProvider.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://" + deviceip + "/onvif/media_service");
requestContext.put(BindingProvider.USERNAME_PROPERTY, user);
requestContext.put(BindingProvider.PASSWORD_PROPERTY, pass);
Recordings recordings = record_port.getRecordings();
上運行上面的代碼給出一個錯誤爲:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Method 'ns11:GetServiceCapabilities' not implemented: method name or namespace not recognized
我也試圖與媒體服務,則該錯誤是:
Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 405: Method Not Allowed
請注意,「錄製」是ONVIF錄像機使用的服務:大多數網絡攝像機不支持它。我認爲你應該在設備功能中檢查它,因爲它是一個可選的服務(取決於所支持的配置文件):http://www.onvif.org/ver10/device/wsdl/GetCapabilities。還有一點需要注意:在最後一行中,您將getRecordings()分配給「功能」......查看http://www.onvif.org/onvif/ver10/recording.wsdl - 我會說這是輸出類型爲GetServiceCapabilities()。請仔細檢查一下。 – Sigismondo
應該檢查Web服務器的安全策略,因爲方法似乎存在於代碼中,但客戶端不允許或不可訪問。 – Ved
同意Ved ...無論誰在實現這個WSDL,都沒有實現某些特性,或者這個名稱空間指向一個不包含該函數的WSDL聲明。就我個人而言,我對WSDL的ONVIF選擇感到吃驚。 –