我真的对Onvif身份验证感到困惑。
我无法在AXIS和SONY摄像机上执行onvif命令。
以下是生成请求的代码:
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:
<?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>
你能告诉我出了什么问题。
谢谢
答案 0 :(得分:1)
故障排除提示:
或者