90

I'm working on Open Network Video Interface Forum-Java project and following the steps described in the ONVIF Application Programmer's Guide.

I have generated sources from the wsdls provided in ONVIF site. I'm able to retrieve the live stream URI using the media.wsdl. Now I have an issue with recording. The codes that I have tried is given below:

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();

The above code on run gives an error as:

Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Method 'ns11:GetServiceCapabilities' not implemented: method name or namespace not recognized

I also tried with media service, then the error is:

Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: The server sent HTTP status code 405: Method Not Allowed
Neenu
  • 6,848
  • 2
  • 28
  • 54
  • 5
    note that "recording" is the service used by ONVIF recorders: most ip cameras don't support it. I think you should check it in the device capabilities, since it is an optional service (depends on the supported profile): http://www.onvif.org/ver10/device/wsdl/GetCapabilities. One more note: in the last line you are assigning getRecordings() to "capabilities"... looking at http://www.onvif.org/onvif/ver10/recording.wsdl - I would say that this is the output type for GetServiceCapabilities(). Just double check it too. – Sigi Jan 17 '14 at 10:41
  • 1
    security policies of web server should be examined, as method seems to be exist in code but not allowed or reachable by client. – Ved Jun 12 '14 at 13:03
  • Agree with Ved... Whoever is implementing this WSDL has either not implemented certain features or the namespace is pointing to a WSDL declaration which does not include the function. Personally, I'm a bit taken aback by this ONVIF choice of WSDL. –  Jun 15 '14 at 00:08

3 Answers3

2

When you tried with the media source, you requested an unauthorized action apparently since the server returned Error code 405. Either the method is prohibited from use, or you need a credential to use the method.

As for Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Method 'ns11:GetServiceCapabilities' not implemented: method name or namespace not recognized, @Sigismondo is right about the fact that most ip cameras don't support it. You will need an alternative recording method(literal and pun) to record from an ip camera.

AMDG
  • 1,118
  • 1
  • 13
  • 29
1

You are using http://" + deviceip + "/onvif/media_service to reach the Recording service, but this is a media.wsdl service. So when you try to call getRecordings on the media service it seems normal you receive an error.

The url for recording.wsdl service should be http://" + deviceip + "/onvif/recording_service.

In order to get the corect URL to reach the recording service you should request it from the GetCapabilities method of the devicemgmt.wsdl service.

mpromonet
  • 11,326
  • 43
  • 62
  • 91
0

HTTP 405 - Resource not allowed usually occurs in IIS. This problem occurs if the following conditions are true:

  • You do not specify the file name. For example, you do not specify http ://Server/Web/...

  • The Scripting Object Model (SOM) is enabled.

  • A DTC event is called.

So, when the SOM is enabled a < form > tag is inserted in the page the tag is invalid means it does not contain any action.

Ashraf.Shk786
  • 618
  • 1
  • 11
  • 23