简体   繁体   English

如何使用Onvif库C#获取设备信息?

[英]How to get device information using Onvif library c#?

I am making ac# windows application which collects the devices connected to my network using an open source library Onvif. 我正在制作ac#Windows应用程序,该应用程序使用开放源代码库Onvif收集连接到我的网络的设备。

i am doing in this way. 我就是这样。

    ServicePointManager.Expect100Continue = false;
    var endPointAddress = new EndpointAddress("http://ip_address:port/onvif/device_service");
    var httpBinding = new HttpTransportBindingElement();            
    var bind = new CustomBinding(httpBinding);
    var temp = new DeviceClient(bind, endPointAddress);
    var request = new GetDeviceInformationRequest();
    var response = temp.GetDeviceInformation(request); ////// Error Here described bellow
    string firm = response.FirmwareVersion;
    string manu = response.Manufacturer;
    string serial = response.SerialNumber;
    string model = response.Model;

Error Message :: There was no endpoint listening at http:// something:port/onvif/device_service that could accept the message.this is often caused by an incorrect address or SOAP action 错误消息::没有端点在http:// something:port / onvif / device_service上接受该消息,这通常是由于地址错误或SOAP操作引起的

can any one help me? 谁能帮我?

I think i am not making proper connection with the server, is it so? 我认为我与服务器的连接不正确,是吗? if so then how to resolve it? 如果是这样,那么如何解决呢?

Maybe the WS-DISCOVERY gives you extra information. 也许WS-DISCOVERY为您提供了更多信息。 I would try not to use any port after the IP of the camera. 我会尝试在摄像机的IP后不使用任何端口。

When the test sends an UDP to the multicast address 239.255.255.250, port 3702 (WS-Discovery), this is the camera's answer: 当测试将UDP发送到组播地址239.255.255.250,端口3702(WS-Discovery)时,这是摄像机的答案:

<?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:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:d="http://schemas.xmlsoap.org/ws/2005/04/discovery" xmlns:dn="http://www.onvif.org/ver10/network/wsdl">
  <SOAP-ENV:Header>
    <wsa:MessageID>uuid:cb3dea50-aa60-11e1-88b9-00408cb972aa</wsa:MessageID>
    <wsa:RelatesTo>uuid:5bca11ff-61b8-4d07-8a26-90274ad51db8</wsa:RelatesTo>
    <wsa:To SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
    <wsa:Action SOAP-ENV:mustUnderstand="true">http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches</wsa:Action>
    <d:AppSequence SOAP-ENV:mustUnderstand="true" MessageNumber="1" InstanceId="1338367479"></d:AppSequence>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <d:ProbeMatches>
      <d:ProbeMatch>
        <wsa:EndpointReference>
          <wsa:Address>urn:uuid:65a142fc-a41e-11e1-9cc8-00408cb972aa</wsa:Address>
        </wsa:EndpointReference>
        <d:Types>dn:NetworkVideoTransmitter</d:Types>
        <d:Scopes>
            onvif://www.onvif.org/type/video_encoder 
            onvif://www.onvif.org/type/ptz 
            onvif://www.onvif.org/hardware/P5534-E 
            onvif://www.onvif.org/name/AXIS%20P5534-E 
            onvif://www.onvif.org/location/ 
        </d:Scopes>
        <d:XAddrs>
            h##p://zeroconfIP/onvif/device_service 
            h##p://unicastIP/onvif/device_service
        </d:XAddrs>
        <d:MetadataVersion>1</d:MetadataVersion>
      </d:ProbeMatch>
    </d:ProbeMatches>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Try to discover the response and see if any XAddrs is not the default you expect. 尝试发现响应,并查看是否有任何XAddrs不是您期望的默认值。

Foscam FI9805E soap response on ONVIF GetCapabilities Foscam FI9805E在ONVIF GetCapabilities上的肥皂响应

- --

- --

-<tds:GetCapabilitiesResponse>


  -<tds:Capabilities xsi:type="tt:Capabilities">


    -<tt:Analytics xsi:type="tt:AnalyticsCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>

      <tt:RuleSupport>true</tt:RuleSupport>

      <tt:AnalyticsModuleSupport>true</tt:AnalyticsModuleSupport>

    </tt:Analytics>


    -<tt:Device xsi:type="tt:DeviceCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>


      -<tt:Network xsi:type="tt:NetworkCapabilities">

        <tt:IPFilter>false</tt:IPFilter>

        <tt:DynDNS>true</tt:DynDNS>

      </tt:Network>


      -<tt:System xsi:type="tt:SystemCapabilities">

        <tt:DiscoveryResolve>true</tt:DiscoveryResolve>

        <tt:DiscoveryBye>true</tt:DiscoveryBye>

        <tt:RemoteDiscovery>false</tt:RemoteDiscovery>

        <tt:SystemBackup>true</tt:SystemBackup>

        <tt:SystemLogging>true</tt:SystemLogging>

        <tt:FirmwareUpgrade>true</tt:FirmwareUpgrade>


        -<tt:SupportedVersions xsi:type="tt:OnvifVersion">

          <tt:Major>2</tt:Major>

          <tt:Minor>21</tt:Minor>

        </tt:SupportedVersions>

      </tt:System>


      -<tt:Security xsi:type="tt:SecurityCapabilities">

        <tt:TLS1.1>false</tt:TLS1.1>

        <tt:TLS1.2>false</tt:TLS1.2>

        <tt:OnboardKeyGeneration>false</tt:OnboardKeyGeneration>

        <tt:AccessPolicyConfig>true</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 xsi:type="tt:EventCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>

      <tt:WSSubscriptionPolicySupport>false</tt:WSSubscriptionPolicySupport>

      <tt:WSPullPointSupport>true</tt:WSPullPointSupport>

      <tt:WSPausableSubscriptionManagerInterfaceSupport>false</tt:WSPausableSubscriptionManagerInterfaceSupport>

    </tt:Events>


    -<tt:Imaging xsi:type="tt:ImagingCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>

    </tt:Imaging>


    -<tt:Media xsi:type="tt:MediaCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>


      -<tt:StreamingCapabilities xsi:type="tt:RealTimeStreamingCapabilities">

        <tt:RTPMulticast>false</tt:RTPMulticast>

        <tt:RTP_TCP>true</tt:RTP_TCP>

        <tt:RTP_RTSP_TCP>true</tt:RTP_RTSP_TCP>

      </tt:StreamingCapabilities>

    </tt:Media>


    -<tt:PTZ xsi:type="tt:PTZCapabilities">

      <tt:XAddr>http://192.168.1.210:8888/onvif/device_service</tt:XAddr>

    </tt:PTZ>


    -<tt:Extension xsi:type="tt:CapabilitiesExtension">


      -<tt:DeviceIO xsi:type="tt:DeviceIOCapabilities">

        <tt:XAddr/>

        <tt:VideoSources>1</tt:VideoSources>

        <tt:VideoOutputs>0</tt:VideoOutputs>

        <tt:AudioSources>1</tt:AudioSources>

        <tt:AudioOutputs>0</tt:AudioOutputs>

        <tt:RelayOutputs>0</tt:RelayOutputs>

      </tt:DeviceIO>

    </tt:Extension>

  </tds:Capabilities>

</tds:GetCapabilitiesResponse>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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