简体   繁体   中英

ONVIF Media.WSDL - GetServiceCapabilities fails

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM