// connect to Dynamics AX
Axapta ax;
System.Net.NetworkCredential networkCredential = new System.Net.NetworkCredential();
networkCredential.UserName = "Administrator"; //Ax >> Administration >> Setup >> Security >> Business connector Proxy account field)
networkCredential.Password = "myPassword";
networkCredential.Domain = "myDoamin";
ax.LogonAs("Administrator", "myDoamin", networkCredential, "dat", "en-us", "01@DEV-PI-AX2009:2712", "");
axContainer = (AxaptaContainer)ax.CallStaticClassMethod("AifServiceReferenceManager", "generate", "http://myServerIP/myFolder/DynamicsAxIntegrationService.svc?wsdl", "myRegisteredServiceName", true);