Cómo generar GetSystemDateAndTime xml

Tengo el siguiente bit de código que tomé deesta fuente ...

public bool Initialise(string cameraAddress, string userName, string password)
    {
        bool result = false;

        try
        {
            var messageElement = new TextMessageEncodingBindingElement()
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };

            HttpTransportBindingElement httpBinding = new HttpTransportBindingElement()
            {
                AuthenticationScheme = AuthenticationSchemes.Digest
            };

            CustomBinding bind = new CustomBinding(messageElement, httpBinding);


            mediaClient = new MediaClient(bind, new EndpointAddress($"http://{cameraAddress}/onvif/Media"));
            mediaClient.ClientCredentials.HttpDigest.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
            mediaClient.ClientCredentials.HttpDigest.ClientCredential.UserName = userName;
            mediaClient.ClientCredentials.HttpDigest.ClientCredential.Password = password;

            var profs = mediaClient.GetProfiles();

            //rest of the code...

Cuando ejecuto wireshark mientras paso por laGetProfiles() parte en el depurador, veo que el XML generado se ve así:

Qué código se necesitaría para cambiar el xml para que se vea así:

¿Cómo se supone que debo llamar alGetSystemDateAndTime función?

Para llamar alGetProfiles función, tuve que crear unMediaClient y, luego, llame a esa función ...

¿Existe un MediaClient para obtener acceso a GetSystemDateAndTime ??

Editar

Encontré que puedes usar laDeviceClient para acceder a laGetSystemDateAndTime función ...

Tendrá que agregar el wsdl de administración de dispositivos a sus servicios conectados antes de:https: //www.onvif.org/ver10/device/wsdl/devicemgmt.wsd

También agreguéSystem.Net.ServicePointManager.Expect100Continue = false; allí porque vi que alguien dijo que ayudó eneste enlac ...

Así que agregué:

CustomBinding bind = new CustomBinding(messageElement, httpBinding);
System.Net.ServicePointManager.Expect100Continue = false;
DeviceClient d = new DeviceClient(bind, new EndpointAddress($"http://{cameraAddress}/onvif/device_service"));
var time = d.GetSystemDateAndTime();

Nota Todavía recibo el error:

        ErrorMessage    "The header 'To' from the namespace 'http://www.w3.org/2005/08/addressing' was not understood by the recipient of this message, causing the message to not be processed.  This error typically indicates that the sender of this message has enabled a communication protocol that the receiver cannot process.  Please ensure that the configuration of the client's binding is consistent with the service's binding. "   string

Respuestas a la pregunta(1)

Su respuesta a la pregunta