8
We are using EWS Java API to use the outlook calendar on our Java application. I am having authentication issues on EWS.
I tried the application on the cloud outlook account that's supplied by rackspace and everything worked just fine so I know the credentials are accurate.
Here is the code:
import java.net.URI;
import java.net.URISyntaxException;
import microsoft.exchange.webservices.data.*;
public class TestClass {
public static void main(String[] args) {
TestClass obj = new TestClass();
obj.testMethod();
}
public void testMethod() {
ExchangeService service = new ExchangeService(
ExchangeVersion.Exchange2007_SP1);
ExchangeCredentials credentials = new WebCredentials("username",
"password");
service.setCredentials(credentials);
try {
service.setUrl(new URI("https://domain/EWS/Exchange.asmx"));
} catch (URISyntaxException e) {
e.printStackTrace();
}
EmailMessage msg;
try {
msg = new EmailMessage(service);
msg.setSubject("hello world");
msg.setBody(MessageBody
.getMessageBodyFromText("Sent using the EWS API"));
msg.getToRecipients().add("test@test.com");
msg.send();
} catch (Exception e) {
e.printStackTrace();
}
}
}
The url for rackspace is:https://connect.emailsrvr.com/EWS/Exchange.asmx
When I put the username and password for this account and it works, I see the console spitting out this one:
Apr 05, 2013 1:40:28 PM org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme
INFO: NTLM authentication scheme selected
Our client is using ExchangeVersion.Exchange2007_SP1 whereas Rackspace is using ExchangeVersion.Exchange2010 But when I use the credentials(username, password and url) that o