0

I need help to define correctly the tds:Service class definition to be able to return the Capabilities of each service (Device, Media, Events).

class ServiceT(DeviceComplexModel):
    __type_name__ = "Service"
    Namespace = AnyUri
    XAddr = AnyUri
    Capabilities = ????????????????????
    Version = OnvifVersion

The tds definition is:

<xs:complexType name="Service">
                <xs:sequence>
                    <xs:element name="Namespace" type="xs:anyURI">
                        <xs:annotation>
                            <xs:documentation>Namespace of the service being described. This parameter allows to match the service capabilities to the service. Note that only one set of capabilities is supported per namespace.</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="XAddr" type="xs:anyURI">
                        <xs:annotation>
                            <xs:documentation>The transport addresses where the service can be reached. The scheme and IP part shall match the one used in the request (i.e. the GetServices request).</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:element name="Capabilities" minOccurs="0">
                        <xs:complexType>
                            <xs:sequence>
                                <xs:any namespace="##any" processContents="lax">
                                    <xs:annotation>
                                        <xs:documentation>The placeholder for the service capabilities. The service capability element shall be returned here. For example for the device service that would be the tds:DeviceServiceCapabilities element (not complextype).</xs:documentation>
                                    </xs:annotation>
                                </xs:any>
                            </xs:sequence>
                        </xs:complexType>
                    </xs:element>
                    <xs:element name="Version" type="tt:OnvifVersion">
                        <xs:annotation>
                            <xs:documentation>The version of the service (not the ONVIF core spec version).</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                    <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:anyAttribute processContents="lax"/>
            </xs:complexType>
Ottavio Campana
  • 4,088
  • 5
  • 31
  • 58
Drx
  • 1
  • 1
    As I said in you previous question, implementing ONVIF by hand is not the corrct way. Python unfortunately lacks tools to implement webservices server-side, as you can see here https://stackoverflow.com/questions/14059142/create-python-soap-server-based-on-wsdl . I suggest switching to another language that has better support. – Ottavio Campana Jan 24 '22 at 06:35

1 Answers1

0

Did you try the following? What's the error you are seeing?

Also, when min/maxOccurs are omitted, they default to 1. The WSDL fragment you quoted is closer to the below:

class ServiceT(DeviceComplexModel):
    __type_name__ = "Service"
    Namespace = AnyUri(min_occurs=1)
    XAddr = AnyUri(min_occurs=1)
    Capabilities = Array(AnyXml)
    Version = OnvifVersion(min_occurs=1)
Burak Arslan
  • 7,671
  • 2
  • 15
  • 24