Esempio n. 1
0
        private MediaClient GetMediaClient()
        {
            EndpointAddress             remoteAddress = new EndpointAddress(string.Format("http://{0}:{1}/onvif/Media", address.Text, 8899));
            HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement();

            httpTransportBindingElement.AuthenticationScheme = AuthenticationSchemes.Digest;
            httpTransportBindingElement.KeepAliveEnabled     = false;
            TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };
            CustomBinding binding = new CustomBinding(new BindingElement[]
            {
                textMessageEncodingBindingElement,
                httpTransportBindingElement
            });
            MediaClient            mediaClient = new MediaClient(binding, remoteAddress);
            PasswordDigestBehavior item        = new PasswordDigestBehavior(camusername, campassword);

            mediaClient.Endpoint.Behaviors.Add(item);
            return(mediaClient);
        }
Esempio n. 2
0
        private PTZClient GetPTZClient()
        {
            EndpointAddress             remoteAddress = new EndpointAddress(string.Format("http://{0}:{1}/onvif/ptz_service", address.Text, 8899));
            HttpTransportBindingElement httpTransportBindingElement = new HttpTransportBindingElement
            {
                AuthenticationScheme = AuthenticationSchemes.Digest
            };
            TextMessageEncodingBindingElement textMessageEncodingBindingElement = new TextMessageEncodingBindingElement
            {
                MessageVersion = MessageVersion.CreateVersion(EnvelopeVersion.Soap12, AddressingVersion.None)
            };
            CustomBinding binding = new CustomBinding(new BindingElement[]
            {
                textMessageEncodingBindingElement,
                httpTransportBindingElement
            });
            PTZClient pTZClient         = new PTZClient(binding, remoteAddress);
            PasswordDigestBehavior item = new PasswordDigestBehavior(camusername, campassword);

            pTZClient.Endpoint.Behaviors.Add(item);
            return(pTZClient);
        }