Onvif 第二课 设备对接问题剖析

场景
        采用ONVIF Device Manager工具可以接入海康摄像机,浏览视频和控制PTZ。手动编写代码调用gSoap库,云台控制失败

排查过程
        抓包POST /onvif/device_service,查看返回PTZ url内容:http://192.168.1.211:37778/onvif/PTZ,说明返回了一个固定地址的url,根本不是设备当前真实的IP地址,而代码中是采用这个地址,进行PTZ地址控制,当然无法实现云台转动,所以需要修改为真实的IP地址,流媒体的Url也是同理

报文内容:
POST /onvif/device_service HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8; action="http://www.onvif.org/ver10/device/wsdl/GetCapabilities"
Host: 58.23.208.26:37778
Content-Length: 952
Accept-Encoding: gzip, deflate
Connection: Close

<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"><s:Header><Security s:mustUnderstand="1" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><UsernameToken><Username>admin</Username><Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">BU1q51sfGhyidhRjLbrQnO78GdI=</Password><Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">kkSJDmaE0EGyNAtf1J8w4hAAAAAAAA==</Nonce><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2020-04-21T01:49:40.587Z</Created></UsernameToken></Security></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><GetCapabilities xmlns="http://www.onvif.org/ver10/device/wsdl"><Category>All</Category></GetCapabilities></s:Body></s:Envelope>HTTP/1.1 200 OK
Date: Tue, 21 Apr 2020 09:49:40 GMT
Server: App-webs/
Connection: close
Content-Length: 5928
Content-Type: application/soap+xml; charset=utf-8

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tt="http://www.onvif.org/ver10/schema" xmlns:tds="http://www.onvif.org/ver10/device/wsdl" xmlns:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:timg="http://www.onvif.org/ver20/imaging/wsdl" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tst="http://www.onvif.org/ver10/storage/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:dn="http://www.onvif.org/ver10/network/wsdl" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:tmd="http://www.onvif.org/ver10/deviceIO/wsdl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl" xmlns:wsoap12="http://schemas.xmlsoap.org/wsdl/soap12" xmlns:http="http://schemas.xmlsoap.org/wsdl/http" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:wsadis="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:wsrf-bf="http://docs.oasis-open.org/wsrf/bf-2" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsrf-r="http://docs.oasis-open.org/wsrf/r-2" xmlns:trc="http://www.onvif.org/ver10/recording/wsdl" xmlns:tse="http://www.onvif.org/ver10/search/wsdl" xmlns:trp="http://www.onvif.org/ver10/replay/wsdl" xmlns:tnshik="http://www.hikvision.com/2011/event/topics" xmlns:hikwsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:hikxsd="http://www.onvifext.com/onvif/ext/ver10/schema"><env:Body><tds:GetCapabilitiesResponse><tds:Capabilities><tt:Analytics><tt:XAddr>http://192.168.1.211:37778/onvif/Analytics</tt:XAddr>
<tt:RuleSupport>true</tt:RuleSupport>
<tt:AnalyticsModuleSupport>true</tt:AnalyticsModuleSupport>
</tt:Analytics>
<tt:Device><tt:XAddr>http://192.168.1.211:37778/onvif/device_service</tt:XAddr>
<tt:Network><tt:IPFilter>true</tt:IPFilter>
<tt:ZeroConfiguration>true</tt:ZeroConfiguration>
<tt:IPVersion6>true</tt:IPVersion6>
<tt:DynDNS>true</tt:DynDNS>
<tt:Extension><tt:Dot11Configuration>false</tt:Dot11Configuration>
<tt:Extension><tt:DHCPv6>true</tt:DHCPv6>
<tt:Dot1XConfigurations>0</tt:Dot1XConfigurations>
</tt:Extension>
</tt:Extension>
</tt:Network>
<tt:System><tt:DiscoveryResolve>false</tt:DiscoveryResolve>
<tt:DiscoveryBye>true</tt:DiscoveryBye>
<tt:RemoteDiscovery>true</tt:RemoteDiscovery>
<tt:SystemBackup>false</tt:SystemBackup>
<tt:SystemLogging>false</tt:SystemLogging>
<tt:FirmwareUpgrade>true</tt:FirmwareUpgrade>
<tt:SupportedVersions><tt:Major>2</tt:Major>
<tt:Minor>20</tt:Minor>
</tt:SupportedVersions>
<tt:SupportedVersions><tt:Major>2</tt:Major>
<tt:Minor>10</tt:Minor>
</tt:SupportedVersions>
<tt:SupportedVersions><tt:Major>2</tt:Major>
<tt:Minor>0</tt:Minor>
</tt:SupportedVersions>
<tt:Extension><tt:HttpFirmwareUpgrade>true</tt:HttpFirmwareUpgrade>
<tt:HttpSystemBackup>false</tt:HttpSystemBackup>
<tt:HttpSystemLogging>false</tt:HttpSystemLogging>
<tt:HttpSupportInformation>false</tt:HttpSupportInformation>
</tt:Extension>
</tt:System>
<tt:IO><tt:InputConnectors>0</tt:InputConnectors>
<tt:RelayOutputs>0</tt:RelayOutputs>
<tt:Extension><tt:Auxiliary>false</tt:Auxiliary>
<tt:AuxiliaryCommands>nothing</tt:AuxiliaryCommands>
<tt:Extension/>
</tt:Extension>
</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:SupportedEAPMethod>0</tt:SupportedEAPMethod>
<tt:RemoteUserHandling>false</tt:RemoteUserHandling>
</tt:Extension>
</tt:Extension>
</tt:Security>
</tt:Device>
<tt:Events><tt:XAddr>http://192.168.1.211:37778/onvif/Events</tt:XAddr>
<tt:WSSubscriptionPolicySupport>true</tt:WSSubscriptionPolicySupport>
<tt:WSPullPointSupport>true</tt:WSPullPointSupport>
<tt:WSPausableSubscriptionManagerInterfaceSupport>false</tt:WSPausableSubscriptionManagerInterfaceSupport>
</tt:Events>
<tt:Imaging><tt:XAddr>http://192.168.1.211:37778/onvif/Imaging</tt:XAddr>
</tt:Imaging>
<tt:Media><tt:XAddr>http://192.168.1.211:37778/onvif/Media</tt:XAddr>
<tt:StreamingCapabilities><tt:RTPMulticast>true</tt:RTPMulticast>
<tt:RTP_TCP>true</tt:RTP_TCP>
<tt:RTP_RTSP_TCP>true</tt:RTP_RTSP_TCP>
</tt:StreamingCapabilities>
<tt:Extension><tt:ProfileCapabilities><tt:MaximumNumberOfProfiles>10</tt:MaximumNumberOfProfiles>
</tt:ProfileCapabilities>
</tt:Extension>
</tt:Media>
<tt:PTZ><tt:XAddr>http://192.168.1.211:37778/onvif/PTZ</tt:XAddr>
</tt:PTZ>
<tt:Extension><hikxsd:hikCapabilities><hikxsd:XAddr>http://192.168.1.211:37778/onvif/hik_ext</hikxsd:XAddr>
<hikxsd:IOInputSupport>false</hikxsd:IOInputSupport>
<hikxsd:PrivacyMaskSupport>true</hikxsd:PrivacyMaskSupport>
<hikxsd:PTZ3DZoomSupport>true</hikxsd:PTZ3DZoomSupport>
<hikxsd:PTZPatternSupport>true</hikxsd:PTZPatternSupport>
</hikxsd:hikCapabilities>
<tt:DeviceIO><tt:XAddr>http://192.168.1.211:37778/onvif/DeviceIO</tt:XAddr>
<tt:VideoSources>1</tt:VideoSources>
<tt:VideoOutputs>0</tt:VideoOutputs>
<tt:AudioSources>1</tt:AudioSources>
<tt:AudioOutputs>1</tt:AudioOutputs>
<tt:RelayOutputs>0</tt:RelayOutputs>
</tt:DeviceIO>
</tt:Extension>
</tds:Capabilities>
</tds:GetCapabilitiesResponse>
</env:Body>
</env:Envelope>

猜你喜欢

转载自blog.51cto.com/fengyuzaitu/2488969