wsDynamicsGP = new DynamicsGP();
System.Net.NetworkCredential nc = new System.Net.NetworkCredential(txtUser.Text , txtPassword.Text, txtDomain.Text);
wsDynamicsGP.Credentials= nc;
This article
http://gp.rosebizincblogs.com/2010/10/gp2010-web-services-java-and-client-authentication.html
appears to address the way to do it from Java. I've read through it and it seems complete... but I'm not a Java developer