如何生成GetSystemDateAndTime XML?附相关C#初始化代码
Generate GetSystemDateAndTime XML for ONVIF (SOAP 1.2, No WS-Addressing)
Hey there! Looking at your initialization code, it’s clear you’re setting up communication with an ONVIF camera using a SOAP 1.2 binding that skips WS-Addressing. Perfect—here’s the exact GetSystemDateAndTime XML request that fits that setup, plus a quick breakdown of what each part does:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tds="http://www.onvif.org/ver10/device/wsdl"> <soap:Body> <tds:GetSystemDateAndTime /> </soap:Body> </soap:Envelope>
Key Details to Match Your Code:
- SOAP 1.2 Compliance: Uses the
http://www.w3.org/2003/05/soap-envelopenamespace, which aligns with yourEnvelopeVersion.Soap12setting. - No WS-Addressing: No
<soap:Header>elements with addressing info, since you specifiedAddressingVersion.Nonein your binding. - ONVIF Device Namespace: The
tdsprefix maps to the ONVIF device service namespace (http://www.onvif.org/ver10/device/wsdl), which is required for theGetSystemDateAndTimeoperation.
Quick Tip for Your C# Code:
If you want to build this request programmatically instead of using raw XML, you can leverage your existing binding’s message version to create a strongly-typed message. For example:
var message = Message.CreateMessage(bind.MessageVersion, "http://www.onvif.org/ver10/device/wsdl/GetSystemDateAndTime"); // You can then send this message via your client channel or request factory
内容的提问来源于stack exchange,提问作者LoukMouk
相关产品推荐
相关产品推荐

