AX – D365FO – Set credentials in AIF Service client / Web Service

This code shows how to pass user and password to a Web Service from AX System.ServiceModel.Description.ClientCredentials clientCredentials; System.ServiceModel.Security.UserNamePasswordClientCredential userNamePasswordClientCredential; System.ServiceModel.BasicHttpBinding basicHttpBinding; System.ServiceModel.BasicHttpSecurity basicHttpSecurity; System.ServiceModel.BasicHttpSecurityMode basicHttpSecurityMode; System.ServiceModel.HttpTransportSecurity httpTransportSecurity; System.ServiceModel.HttpClientCredentialType httpClientCredentialType; System.ServiceModel.EndpointAddress endpointAddress; System.ServiceModel.Description.ServiceEndpoint endpoint; SiemensT4EAImport.T4EAImportService.DefaultPortTypeClient serviceClient; System.Type serviceClientType; serviceClientType = CLRInterop::getType('T4EAImport.ImportService.DefaultPortTypeClient'); serviceClient = AifUtil::createServiceClient(serviceClientType); basicHttpSecurityMode = System.ServiceModel.BasicHttpSecurityMode::TransportCredentialOnly; httpClientCredentialType = System.ServiceModel.HttpClientCredentialType::Basic; httpTransportSecurity = new System.ServiceModel.HttpTransportSecurity(); httpTransportSecurity.set_ClientCredentialType(httpClientCredentialType); basicHttpSecurity … Continue reading AX – D365FO – Set credentials in AIF Service client / Web Service