Onvif-无效的SOAP消息或SOAP版本不匹配 [英] Onvif - Invalid SOAP message or SOAP version mismatch

查看:203
本文介绍了Onvif-无效的SOAP消息或SOAP版本不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的对Onvif身份验证感到困惑.

I have really been confused with Onvif Authentication.

我在AXIS和SONY相机上都无法执行onvif命令.

I have failed to execute onvif commands both on AXIS ans SONY cameras.

以下是生成请求的代码:

Here is the code generating a request:

procedure RebootDevice(dev: Device; Username, Password: string);
var
  sdt: SystemDateTime;
  Created: string;
  Nonce: string;
  Nonce64: string;
  Password64: string;
  Header: Security;
begin
  sdt := dev.GetSystemDateAndTime;
  Created := SystemDateTimeToStr(sdt.UTCDateTime); // yyyy-MM-ddTHH.mm.ss.000Z
  Nonce := '1234';
  Nonce64 := Base64Encode(Nonce);
  Password64 := Base64Encode(HashSHA1(Nonce+Created+Password));
  Header.UsernameToken.Username := Username;
  Header.UsernameToken.Password.Type := 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest';
  Header.UsernameToken.Password.Text := Password64;
  Header.UsernameToken.Nonce.EncodingType := 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary';
  Header.UsernameToken.Nonce.Text := Nonce64;
  Header.UsernameToken.Created := Created;
  SetHeader(Header)
  dev.SystemReboot;  // <---- Error in here
end;

生成的SOAP XML:

Generated SOAP XML:

<?xml version="1.0"?>
<SOAP-ENV:Envelope 
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Header 
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 
        xmlns:NS1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
        <NS1:Security
            SOAP-ENV:mustUnderstand="1">
            <NS1:UsernameToken>
                <Username>
                    admin
                </Username>
                <NS1:Password 
                    Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">
                   +sWiewkgfkjFqzW2O5cuGJr9SiE=
                </NS1:Password>
                <NS1:Nonce 
                    EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">
                    MTIzNA==
                </NS1:Nonce>
                <Created>
                    2004-01-03T08:20:09.000Z
                </Created>
            </NS1:UsernameToken>
        </NS1:Security>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body 
        xmlns:NS2="http://www.onvif.org/ver10/device/wsdl"
        SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
       <NS2:SystemReboot/>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

这是响应:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/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:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" 
    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:wsa5="http://www.w3.org/2005/08/addressing" 
    xmlns:xmime="http://tempuri.org/xmime.xsd" 
    xmlns:xop="http://www.w3.org/2004/08/xop/include" 
    xmlns:wsrfbf="http://docs.oasis-open.org/wsrf/bf-2" 
    xmlns:wstop="http://docs.oasis-open.org/wsn/t-1" 
    xmlns:tt="http://www.onvif.org/ver10/schema" 
    xmlns:wsrfr="http://docs.oasis-open.org/wsrf/r-2" 
    xmlns:aa="http://www.axis.com/vapix/ws/action1" 
    xmlns:aev="http://www.axis.com/vapix/ws/event1" 
    xmlns:tan1="http://www.onvif.org/ver20/analytics/wsdl/RuleEngineBinding"
    xmlns:tan2="http://www.onvif.org/ver20/analytics/wsdl/AnalyticsEngineBinding"
    xmlns:tan="http://www.onvif.org/ver20/analytics/wsdl" 
    xmlns:tds="http://www.onvif.org/ver10/device/wsdl" 
    xmlns:tev1="http://www.onvif.org/ver10/events/wsdl/NotificationProducerBinding" 
    xmlns:tev2="http://www.onvif.org/ver10/events/wsdl/EventBinding" 
    xmlns:tev3="http://www.onvif.org/ver10/events/wsdl/SubscriptionManagerBinding" 
    xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
    xmlns:tev4="http://www.onvif.org/ver10/events/wsdl/PullPointSubscriptionBinding" 
    xmlns:tev="http://www.onvif.org/ver10/events/wsdl"
    xmlns:timg="http://www.onvif.org/ver20/imaging/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:tnsaxis="http://www.axis.com/2009/event/topics">
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault 
            SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <SOAP-ENV:Code>
                <SOAP-ENV:Value>
                    env:VersionMismatch
                </SOAP-ENV:Value>
            </SOAP-ENV:Code>
            <SOAP-ENV:Reason>
                <SOAP-ENV:Text 
                    xml:lang="en">
                    SOAP version mismatch
                </SOAP-ENV:Text>
            </SOAP-ENV:Reason>
            <SOAP-ENV:Detail>
                <SOAP-ENV:Text>
                    Invalid SOAP message or SOAP version mismatch
                </SOAP-ENV:Text>
            </SOAP-ENV:Detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

你能告诉妈妈出什么事了吗

Could you please tell ma what is going wrong.

谢谢

推荐答案

故障排除提示:

  • 首先,尝试使用SoapUI之类的工具访问该服务并验证其是否发送了预期的响应
  • 比较SoapUI和Delphi的请求(标​​头和正文)

  • 使用Fiddler或Wireshark捕获HTTP流量,并比较Delphi/OnvifDM请求

这篇关于Onvif-无效的SOAP消息或SOAP版本不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆