0

I need help with defining the "Capabilities" class so it would pass the Device Tool Test tests.

STEP 5 - Get Media Service capabilities
      StepStart: 2022-01-19T07:35:14.1804753Z
      Transmit done
      Receive done
      The element 'Capabilities' in namespace 'http://www.onvif.org/ver10/media/wsdl' has invalid child element 'ProfileCapabilities' in namespace 'http://www.onvif.org/ver10/schema'. List of possible elements expected: 'ProfileCapabilities' in namespace 'http://www.onvif.org/ver10/media/wsdl'.
   STEP FAILED

The response:

<soap12env:Body>
    <tns:GetServiceCapabilitiesResponse>
        <tns:Capabilities
            SnapshotUri="true"
            Rotation="false"
            VideoSourceMode="false"
            OSD="false">
            <s0:ProfileCapabilities
                MaximumNumberOfProfiles="10"/>
            <s0:StreamingCapabilities
                RTPMulticast="false"
                RTP_TCP="true"
                RTP_RTSP_TCP="true"
                NonAggregateControl="false"
                NoRTSPStreaming="false"/>
            </tns:Capabilities>
        </tns:GetServiceCapabilitiesResponse>
    </soap12env:Body>

My Code:

Classes:

class ProfileCapabilitiesT(SchemaComplexModel):
    __type_name__ = "ProfileCapabilities"
    MaximumNumberOfProfiles = XmlAttribute(Int)

class StreamingCapabilitiesT(SchemaComplexModel):
    __type_name__ = "StreamingCapabilities"
    RTPMulticast = XmlAttribute(Boolean)
    RTP_TCP = XmlAttribute(Boolean)
    RTP_RTSP_TCP = XmlAttribute(Boolean)
    NonAggregateControl = XmlAttribute(Boolean)
    NoRTSPStreaming = XmlAttribute(Boolean)

class CapabilitiesT(SchemaComplexModel):
    __type_name__ = "Capabilities"
    ProfileCapabilities = ProfileCapabilitiesT
    StreamingCapabilities = StreamingCapabilitiesT
    SnapshotUri = XmlAttribute(Boolean)
    Rotation = XmlAttribute(Boolean)
    VideoSourceMode = XmlAttribute(Boolean)
    OSD = XmlAttribute(Boolean)
    
class GetServiceCapabilitiesResponseT(MediaComplexModel):
    Capabilities = CapabilitiesT

Function:

@rpc(_returns=GetServiceCapabilitiesResponseT, _body_style="out_bare")
def GetServiceCapabilities(ctx):
    logging.info("GetServiceCapabilities")
        
    ret = GetServiceCapabilitiesResponseT()
    caps = CapabilitiesT()
        
    p = ProfileCapabilitiesT()
    n = config.MAX_PROFILES
    p.MaximumNumberOfProfiles = n
    caps.ProfileCapabilities = p

    s = StreamingCapabilitiesT()
    s.RTPMulticast = False
    s.RTP_TCP = True
    s.RTP_RTSP_TCP = True
    s.NonAggregateControl = False
    s.NoRTSPStreaming = False
    caps.StreamingCapabilities = s

    caps.SnapshotUri = True
    caps.Rotation = False
    caps.VideoSourceMode = False
    caps.OSD = False

    ret.Capabilities = caps 
    return ret

What is wrong with the definitions?

Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
Drx
  • 1

1 Answers1

0

The test tool tells you why it does not work.

You have a ProfileCapabilities in the namespace http://www.onvif.org/ver10/schema but the correct implementation must have ProfileCapabilities in the namespace http://www.onvif.org/ver10/media/wsdl.

Thus, you need to fix the namespace.

In general, the ONVIF test tool is very useful, because it describes well which step did not pass and why.

Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
  • The suggestion worked OK, Thanks. I have another issue with "tds:Service". I need held to define correctly the "Capabilities" element. class ServiceT(DeviceComplexModel): __type_name__ = "Service" Namespace = AnyUri XAddr = AnyUri Capabilities = ????????? Version = OnvifVersion – Drx Jan 20 '22 at 15:06
  • This is not the way you should implement ONVIF. You should generate the code with a tool such as gsoap and not implementi it by hand. – Ottavio Campana Jan 21 '22 at 16:51
  • Hi Ottavio, Please check my other question ONVIF - GetServices with Capabilities does not return the capabilities of each service I will appritiate any help , I want to pass Profile S tests. Thanks David Ron – Drx Jan 23 '22 at 07:16