python-zeep icon indicating copy to clipboard operation
python-zeep copied to clipboard

Zeep returned empty array

Open Vorobeyko opened this issue 7 years ago • 2 comments

I used zeep for send request to onvif-cameras by onvif specification.

I send request GetCapabilities and i got response like xml:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:saml1="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:saml2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:o2kvmd="http://www.o2kvmd.com/onvif-sdk/v1" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:ns5="http://www.onvif.org/ver20/analytics" xmlns:ns2="http://www.onvif.org/ver10/pacs" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:xmime="http://tempuri.org/xmime.xsd" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" xmlns:ns1="http://www.onvif.org/ver10/accesscontrol/wsdl" xmlns:ns10="http://www.onvif.org/ver10/thermal/wsdl" xmlns:ns3="http://www.onvif.org/ver10/accessrules/wsdl" xmlns:ns4="http://www.onvif.org/ver10/advancedsecurity/wsdl" xmlns:ns6="http://www.onvif.org/ver10/credential/wsdl" xmlns:ns7="http://www.onvif.org/ver10/doorcontrol/wsdl" xmlns:ns8="http://www.onvif.org/ver10/provisioning/wsdl" xmlns:ns9="http://www.onvif.org/ver10/schedule/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:trv="http://www.onvif.org/ver10/receiver/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl">
	<SOAP-ENV:Header/>
	<SOAP-ENV:Body>
		<tds:GetCapabilitiesResponse>
			<tds:Capabilities>
				<tt:Device>
					<tt:XAddr>http://10.184.1.114:80/onvif/device_service</tt:XAddr>
					<tt:Network>
						<tt:IPFilter>false</tt:IPFilter>
						<tt:ZeroConfiguration>false</tt:ZeroConfiguration>
						<tt:IPVersion6>false</tt:IPVersion6>
						<tt:DynDNS>false</tt:DynDNS>
					</tt:Network>
					<tt:System>
						<tt:DiscoveryResolve>false</tt:DiscoveryResolve>
						<tt:DiscoveryBye>true</tt:DiscoveryBye>
						<tt:RemoteDiscovery>false</tt:RemoteDiscovery>
						<tt:SystemBackup>false</tt:SystemBackup>
						<tt:SystemLogging>false</tt:SystemLogging>
						<tt:FirmwareUpgrade>false</tt:FirmwareUpgrade>
						<tt:SupportedVersions>
							<tt:Major>2</tt:Major>
							<tt:Minor>60</tt:Minor>
						</tt:SupportedVersions>
						<tt:Extension>
							<tt:HttpFirmwareUpgrade>false</tt:HttpFirmwareUpgrade>
							<tt:HttpSystemBackup>false</tt:HttpSystemBackup>
							<tt:HttpSystemLogging>false</tt:HttpSystemLogging>
						</tt:Extension>
					</tt:System>
					<tt:IO>
						<tt:InputConnectors>0</tt:InputConnectors>
						<tt:RelayOutputs>0</tt:RelayOutputs>
					</tt:IO>
					<tt:Security>
						<tt:TLS1.1>false</tt:TLS1.1>
						<tt:TLS1.2>false</tt:TLS1.2>
						<tt:OnboardKeyGeneration>false</tt:OnboardKeyGeneration>
						<tt:AccessPolicyConfig>false</tt:AccessPolicyConfig>
						<tt:X.509Token>false</tt:X.509Token>
						<tt:SAMLToken>false</tt:SAMLToken>
						<tt:KerberosToken>false</tt:KerberosToken>
						<tt:RELToken>false</tt:RELToken>
						<tt:Extension>
							<tt:TLS1.0>false</tt:TLS1.0>
							<tt:Extension>
								<tt:Dot1X>false</tt:Dot1X>
								<tt:RemoteUserHandling>false</tt:RemoteUserHandling>
							</tt:Extension>
						</tt:Extension>
					</tt:Security>
				</tt:Device>
				<tt:Events>
					<tt:XAddr>http://10.184.1.114:80/onvif/event_service</tt:XAddr>
					<tt:WSSubscriptionPolicySupport>false</tt:WSSubscriptionPolicySupport>
					<tt:WSPullPointSupport>false</tt:WSPullPointSupport>
					<tt:WSPausableSubscriptionManagerInterfaceSupport>false</tt:WSPausableSubscriptionManagerInterfaceSupport>
				</tt:Events>
				<tt:Media>
					<tt:XAddr>http://10.184.1.114:80/onvif/media_service</tt:XAddr>
					<tt:StreamingCapabilities>
						<tt:RTPMulticast>false</tt:RTPMulticast>
						<tt:RTP_TCP>false</tt:RTP_TCP>
						<tt:RTP_RTSP_TCP>true</tt:RTP_RTSP_TCP>
					</tt:StreamingCapabilities>
				</tt:Media>
				<tt:PTZ>
					<tt:XAddr>http://10.184.1.114:80/onvif/ptz_service</tt:XAddr>
				</tt:PTZ>
				<tt:Extension>
					<tt:DeviceIO>
						<tt:XAddr>http://10.184.1.114:80/onvif/device_io_service</tt:XAddr>
						<tt:VideoSources>3</tt:VideoSources>
						<tt:VideoOutputs>0</tt:VideoOutputs>
						<tt:AudioSources>0</tt:AudioSources>
						<tt:AudioOutputs>0</tt:AudioOutputs>
						<tt:RelayOutputs>0</tt:RelayOutputs>
					</tt:DeviceIO>
					<tt:Recording>
						<tt:XAddr>http://10.184.1.114:80/onvif/recording_service</tt:XAddr>
						<tt:ReceiverSource>false</tt:ReceiverSource>
						<tt:MediaProfileSource>true</tt:MediaProfileSource>
						<tt:DynamicRecordings>false</tt:DynamicRecordings>
						<tt:DynamicTracks>false</tt:DynamicTracks>
						<tt:MaxStringLength>64</tt:MaxStringLength>
					</tt:Recording>
					<tt:Search>
						<tt:XAddr>http://10.184.1.114:80/onvif/search_service</tt:XAddr>
						<tt:MetadataSearch>true</tt:MetadataSearch>
					</tt:Search>
					<tt:Replay>
						<tt:XAddr>http://10.184.1.114:80/onvif/replay_service</tt:XAddr>
					</tt:Replay>
				</tt:Extension>
			</tds:Capabilities>
		</tds:GetCapabilitiesResponse>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

but when this message parse - i got json like:

{
	'Analytics': None,
	'Device': {
		'XAddr': 'http://10.184.1.114:80/onvif/device_service',
		'Network': {
			'IPFilter': False,
			'ZeroConfiguration': False,
			'IPVersion6': False,
			'DynDNS': False,
			'Extension': None,
			'_attr_1': None
		},
		'System': {
			'DiscoveryResolve': False,
			'DiscoveryBye': True,
			'RemoteDiscovery': False,
			'SystemBackup': False,
			'SystemLogging': False,
			'FirmwareUpgrade': False,
			'SupportedVersions': [
				{
					'Major': 2,
					'Minor': 60
				}
			],
			'Extension': {
				'_value_1': [
					<Element {http://www.onvif.org/ver10/schema}HttpFirmwareUpgrade at 0x5536760>,
					<Element {http://www.onvif.org/ver10/schema}HttpSystemBackup at 0x5536788>,
					<Element {http://www.onvif.org/ver10/schema}HttpSystemLogging at 0x55367b0>
				],
				'HttpFirmwareUpgrade': None,
				'HttpSystemBackup': None,
				'HttpSystemLogging': None,
				'HttpSupportInformation': None,
				'Extension': None
			},
			'_attr_1': None
		},
		'IO': {
			'InputConnectors': 0,
			'RelayOutputs': 0,
			'Extension': None,
			'_attr_1': None
		},
		'Security': {
			'TLS1.1': False,
			'TLS1.2': False,
			'OnboardKeyGeneration': False,
			'AccessPolicyConfig': False,
			'X.509Token': False,
			'SAMLToken': False,
			'KerberosToken': False,
			'RELToken': False,
			'_value_1': [
				<Element {http://www.onvif.org/ver10/schema}Extension at 0x553a418>
			],
			'Extension': None,
			'_attr_1': None
		},
		'Extension': None,
		'_attr_1': None
	},
	'Events': {
		'XAddr': 'http://10.184.1.114:80/onvif/event_service',
		'WSSubscriptionPolicySupport': False,
		'WSPullPointSupport': False,
		'WSPausableSubscriptionManagerInterfaceSupport': False,
		'_value_1': None,
		'_attr_1': None
	},
	'Imaging': None,
	'Media': {
		'XAddr': 'http://10.184.1.114:80/onvif/media_service',
		'StreamingCapabilities': {
			'RTPMulticast': False,
			'RTP_TCP': False,
			'RTP_RTSP_TCP': True,
			'Extension': None,
			'_attr_1': None
		},
		'_value_1': None,
		'Extension': None,
		'_attr_1': None
	},
	'PTZ': {
		'XAddr': 'http://10.184.1.114:80/onvif/ptz_service',
		'_value_1': None,
		'_attr_1': None
	},
	'Extension': {
		'_value_1': [
			<Element {http://www.onvif.org/ver10/schema}DeviceIO at 0x5543080>,
			<Element {http://www.onvif.org/ver10/schema}Recording at 0x55433c8>,
			<Element {http://www.onvif.org/ver10/schema}Search at 0x55433f0>,
			<Element {http://www.onvif.org/ver10/schema}Replay at 0x5543418>
		],
		'DeviceIO': None,
		'Display': None,
		'Recording': None,
		'Search': None,
		'Replay': None,
		'Receiver': None,
		'AnalyticsDevice': None,
		'Extensions': None
	},
	'_attr_1': None
}

i.e. in last element "Extension" in Json foramt all elements (like Search, Display and etc.) not have elements.

Please, help me solved this problem!)

Vorobeyko avatar Oct 05 '17 13:10 Vorobeyko

I had a similar error, and solved it by only using the objects defined by the WSDL instead of using dicts.

ma-rp avatar Oct 30 '17 18:10 ma-rp

I have the same issues ...

I do not understand why this library struggles with much of the WSDL ONVIF spec ???

EmpireofKings avatar Nov 10 '22 07:11 EmpireofKings