Пример #1
0
        private void OpenServiceCodeUnitEntregaAlmacen()
        {
            List <webServiceEmpresa> empresaConfig = configuracion.getDatosEmpresa();

            string usuario  = string.Format(@"{0}\administrador", empresaConfig[0].dominio);
            string password = @"Paulagallardo2014";

            string url = @"http://{1}/DynamicsNAV/WS/{0}/Codeunit/AlmacenRepuestos";

            url = string.Format(url, empresaConfig[0].empresa, empresaConfig[0].url);

            BasicHttpBinding navisionWSBinding = new BasicHttpBinding();

            navisionWSBinding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
            navisionWSBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
            navisionWSBinding.MaxReceivedMessageSize = 2000971520;


            codeUnitEntregaAlmacen = new AlmacenRepuestos_PortClient(navisionWSBinding, new EndpointAddress(url));
            codeUnitEntregaAlmacen.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;
            codeUnitEntregaAlmacen.ClientCredentials.Windows.ClientCredential          = new System.Net.NetworkCredential(usuario, password);
        }
Пример #2
0
 private static void initAlmacenesClientesPortCliente(BasicHttpBinding navisionWSBinding, HostWebService hostWs)
 {
     contextAlmacenesRepuestos = new AlmacenRepuestos_PortClient(navisionWSBinding, new EndpointAddress(string.Format(hostWs.urlHost, "AlmacenRepuestos", HostWebService.tipoWebService.Codeunit.ToString())));
     contextAlmacenesRepuestos.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;
     contextAlmacenesRepuestos.ClientCredentials.Windows.ClientCredential          = new System.Net.NetworkCredential(hostWs.user, hostWs.password);
 }