Created
December 18, 2020 16:08
-
-
Save kjlaw89/02472f85f9e7c2581af9830100f19708 to your computer and use it in GitHub Desktop.
Go ONVIF Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go ONVIF: | |
Program: | |
``` | |
package main | |
import ( | |
"log" | |
"github.com/use-go/onvif" | |
"github.com/use-go/onvif/device" | |
) | |
func main() { | |
dev, err := onvif.NewDevice("192.168.112.129") | |
if err != nil { | |
panic(err) | |
} | |
dev.Authenticate("admin", "123456") | |
systemDateAndTyme := device.GetSystemDateAndTime{} | |
systemDateAndTymeResponse, err := dev.CallMethod(systemDateAndTyme) | |
if err != nil { | |
panic(err) | |
} | |
log.Printf("output %+v", dev.GetServices()) | |
log.Printf("response %+v", systemDateAndTymeResponse) | |
} | |
``` | |
Request: | |
POST /onvif/device_service HTTP/1.1 | |
Host: 192.168.112.129 | |
User-Agent: Go-http-client/1.1 | |
Content-Length: 1083 | |
Content-Type: application/soap+xml; charset=utf-8 | |
Accept-Encoding: gzip | |
<?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:onvif="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:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tev="http://www.onvif.org/ver10/events/wsdl" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:xop="http://www.w3.org/2004/08/xop/include"> | |
<soap-env:Header/> | |
<soap-env:Body> | |
<tds:GetCapabilities> | |
<tds:Category>All</tds:Category> | |
</tds:GetCapabilities> | |
</soap-env:Body> | |
</soap-env:Envelope> | |
Response: | |
HTTP/1.1 200 OK | |
Server: gSOAP/2.8 | |
Access-Control-Allow-Origin: * | |
Content-Type: application/soap+xml; charset=utf-8 | |
Content-Length: 5431 | |
Connection: close | |
<?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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" 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:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/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:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" 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://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 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:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:trt2="http://www.onvif.org/ver20/media/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:ewsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:exsd="http://www.onvifext.com/onvif/ext/ver10/schema"> | |
<SOAP-ENV:Header></SOAP-ENV:Header> | |
<SOAP-ENV:Body> | |
<tds:GetCapabilitiesResponse> | |
<tds:Capabilities> | |
<tt:Analytics> | |
<tt:XAddr>http://192.168.112.129:80/onvif/analytics</tt:XAddr> | |
<tt:RuleSupport>true</tt:RuleSupport> | |
<tt:AnalyticsModuleSupport>true</tt:AnalyticsModuleSupport> | |
</tt:Analytics> | |
<tt:Device> | |
<tt:XAddr>http://192.168.112.129:80/onvif/device</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:Extension> | |
<tt:Dot11Configuration>false</tt:Dot11Configuration> | |
</tt:Extension> | |
</tt:Network> | |
<tt:System> | |
<tt:DiscoveryResolve>false</tt:DiscoveryResolve> | |
<tt:DiscoveryBye>false</tt:DiscoveryBye> | |
<tt:RemoteDiscovery>false</tt:RemoteDiscovery> | |
<tt:SystemBackup>false</tSystemBackup> | |
<tt:SystemLogging>true</tt:SystemLogging> | |
<tt:FirmwareUpgrade>true</tt:FirmwareUpgrade> | |
<tt:SupportedVersions> | |
<tt:Major>17</tt:Major> | |
<tt:Minor>6</tt:Minor> | |
</tt:SupportedVersions> | |
<tt:Extension> | |
<tt:HttpFirmwareUpgrade>true</tt:HttpFirmwareUpgrade> | |
<tt:HttpSystemBackup>false</tt:HttpSystemBackup> | |
<tt:HttpSystemLogging>true</tt:HttpSystemLogging> | |
<tt:HttpSupportInformation>true</tt:HttpSupportInformation> | |
</tt:Extension> | |
</tt:System> | |
<tt:IO> | |
<tt:InputConnectors>1</tt:InputConnectors> | |
<tt:RelayOutputs>1</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:Security> | |
</tt:Device> | |
<tt:Events> | |
<tt:XAddr>http://192.168.112.129:80/onvif/events</tt:XAddr> | |
<tt:WSSubscriptionPolicySupport>true</tt:WSSubscriptionPolicySupport> | |
<tt:WSPullPointSupport>true</tt:WSPullPointSupport> | |
<tt:WSPausableSubscriptionManagerInterfaceSupport>true</tt:WSPausableSubscriptionManagerInterfaceSupport> | |
</tt:Events> | |
<tt:Imaging> | |
<tt:XAddr>http://192.168.112.129:80/onvif/imaging</tt:XAddr> | |
</tt:Imaging> | |
<tt:Media> | |
<tt:XAddr>http://192.168.112.129:80/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:Media> | |
<tt:PTZ> | |
<tt:XAddr>http://192.168.112.129:80/onvif/ptz</tt:XAddr> | |
</tt:PTZ> | |
<tt:Extension> | |
<tt:DeviceIO> | |
<tt:XAddr>http://192.168.112.129:80/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>1</tt:RelayOutputs> | |
</tt:DeviceIO> | |
<tt:Extensions> | |
<tt:TelexCapabilities> | |
<tt:XAddr>http://192.168.112.129:80/onvif/telecom_service</tt:XAddr> | |
<tt:TimeOSDSupport>true</tt:TimeOSDSupport> | |
<tt:TitleOSDSupport>true</tt:TitleOSDSupport> | |
<tt:PTZ3DZoomSupport>true</tt:PTZ3DZoomSupport> | |
<tt:PTZAuxSwitchSupport>true</tt:PTZAuxSwitchSupport> | |
<tt:MotionDetectorSupport>true</tt:MotionDetectorSupport> | |
<tt:TamperDetectorSupport>true</tt:TamperDetectorSupport> | |
</tt:TelexCapabilities> | |
</tt:Extensions> | |
<ewsd:hbCapabilities> | |
<exsd:XAddr>http://192.168.112.129:80/onvif/hbgk_ext</exsd:XAddr> | |
<exsd:H265Support>true</exsd:H265Support> | |
<exsd:PrivacyMaskSupport>true</exsd:PrivacyMaskSupport> | |
<exsd:CameraNum>1</exsd:CameraNum> | |
<exsd:MaxMaskAreaNum>4</exsd:MaxMaskAreaNum> | |
</ewsd:hbCapabilities> | |
</tt:Extension> | |
</tds:Capabilities> | |
</tds:GetCapabilitiesResponse> | |
</SOAP-ENV:Body> | |
</SOAP-ENV:Envelope> | |
Request: | |
POST /onvif/device HTTP/1.1 | |
Host: 192.168.112.129:80 | |
User-Agent: Go-http-client/1.1 | |
Content-Length: 1688 | |
Content-Type: application/soap+xml; charset=utf-8 | |
Accept-Encoding: gzip | |
<?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:xop="h | |
ttp://www.w3.org/2004/08/xop/include" xmlns:tptz="http://www.onvif.org/ver20/ptz/wsdl" xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:xmime="http://www.w3.org/2005/05/xml | |
mime" xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2" xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2" xmlns:onvif="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:wstop="http://docs.oasis-open.org/wsn/t-1" xmlns:tev=" | |
http://www.onvif.org/ver10/events/wsdl" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2" xmlns:wsaw="http://www.w3.org/2006/05/add | |
ressing/wsdl"> | |
<soap-env:Header> | |
<Security 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">E2EtVX9GcD7s/SYfE9QKYPnFfWo=</Password> | |
<Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">phyfles33ih122j444camr3tzmjqiagz</Nonce> | |
<Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2020-12-18T15:31:59.127035915Z</Created> | |
</UsernameToken> | |
</Security> | |
</soap-env:Header> | |
<soap-env:Body> | |
<tds:GetSystemDateAndTime/> | |
</soap-env:Body> | |
</soap-env:Envelope> | |
Response: | |
HTTP/1.1 200 OK | |
Server: gSOAP/2.8 | |
Access-Control-Allow-Origin: * | |
Content-Type: application/soap+xml; charset=utf-8 | |
Content-Length: 3206 | |
Connection: close | |
<?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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsdd="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" 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:tan="http://www.onvif.org/ver20/analytics/wsdl" xmlns:tdn="http://www.onvif.org/ver10/network/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:c14n="http://www.w3.org/2001/10/xml-exc-c14n#" 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://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 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:trt="http://www.onvif.org/ver10/media/wsdl" xmlns:ter="http://www.onvif.org/ver10/error" xmlns:tns1="http://www.onvif.org/ver10/topics" xmlns:trt2="http://www.onvif.org/ver20/media/wsdl" xmlns:tr2="http://www.onvif.org/ver20/media/wsdl" xmlns:ewsd="http://www.onvifext.com/onvif/ext/ver10/wsdl" xmlns:exsd="http://www.onvifext.com/onvif/ext/ver10/schema"> | |
<SOAP-ENV:Header> | |
<wsse:Security> | |
<wsse:UsernameToken> | |
<wsse:Username>admin</wsse:Username> | |
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">E2EtVX9GcD7s/SYfE9QKYPnFfWo=</wsse:Password> | |
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">phyfles33ih122j444camr3tzmjqiagz</wsse:Nonce> | |
<wsu:Created>2020-12-18T15:31:59.127035915Z</wsu:Created> | |
</wsse:UsernameToken> | |
</wsse:Security> | |
</SOAP-ENV:Header> | |
<SOAP-ENV:Body> | |
<tds:GetSystemDateAndTimeResponse> | |
<tds:SystemDateAndTime> | |
<tt:DateTimeType>NTP</tt:DateTimeType> | |
<tt:DaylightSavings>false</tt:DaylightSavings> | |
<tt:TimeZone> | |
<tt:TZ>CST-8</tt:TZ> | |
</tt:TimeZone> | |
<tt:UTCDateTime> | |
<tt:Time> | |
<tt:Hour>23</tt:Hour> | |
<tt:Minute>32</tt:Minute> | |
<tt:Second>35</tt:Second> | |
</tt:Time> | |
<tt:Date> | |
<tt:Year>2020</tt:Year> | |
<tt:Month>12</tt:Month> | |
<tt:Day>17</tt:Day> | |
</tt:Date> | |
</tt:UTCDateTime> | |
<tt:LocalDateTime> | |
<tt:Time> | |
<tt:Hour>7</tt:Hour> | |
<tt:Minute>32</tt:Minute> | |
<tt:Second>35</tt:Second> | |
</tt:Time> | |
<tt:Date> | |
<tt:Year>2020</tt:Year> | |
<tt:Month>12</tt:Month> | |
<tt:Day>18</tt:Day> | |
</tt:Date> | |
</tt:LocalDateTime> | |
</tds:SystemDateAndTime> | |
</tds:GetSystemDateAndTimeResponse> | |
</SOAP-ENV:Body> | |
</SOAP-ENV:Envelope> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment