none
Regarding connection with EWSJavaAPI1.1 RRS feed

  • Question

  • Hi,

    I am using EWSJavaAPI1.1 API to make connection with Exchange server 2007. I have gone through some of the tech notes and found that ExchangeService class is being used to make connection. I have used the code as follows

     

    private ExchangeService m_EWSservice = new ExchangeService();

     ExchangeCredentials credentials = new WebCredentials("<mail id>",

    " <password>");

                 m_EWSservice.setCredentials(credentials);

                 m_EWSservice.setUrl(new URI("https://<exchange server>/EWS/Services.wsdl"));

                 m_EWSservice.prepareHttpWebRequest();

                 m_EWSservice.setTraceEnabled( true );

    when i try to invoke this service object to save any of my item i got the following exception.

     

    java.lang.NullPointerException

    at java.util.regex.Matcher.getTextLength(Unknown Source)

    at java.util.regex.Matcher.reset(Unknown Source)

    at java.util.regex.Matcher.<init>(Unknown Source)

    at java.util.regex.Pattern.matcher(Unknown Source)

    at java.util.Formatter.parse(Unknown Source)

    at java.util.Formatter.format(Unknown Source)

    at java.util.Formatter.format(Unknown Source)

    at java.lang.String.format(Unknown Source)

    at microsoft.exchange.webservices.data.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:728)

    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:36)

    at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:142)

    at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:346)

    at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:370)

    at microsoft.exchange.webservices.data.Folder.bind(Folder.java:49)

    at microsoft.exchange.webservices.data.Folder.bind(Folder.java:90)

    at connection.Connection.<init>(Connection.java:62)

    at test.TestConnection.main(TestConnection.java:23)

     

    Can anyone tell me where i am missing the parameteres. Please let me know how to make connection or give me sample example so that i can make my item with an ease.

    Thanks in advance

    Tuesday, March 15, 2011 1:47 PM

All replies

  • Your url doesn't look correct it should be

    m_EWSservice.setUrl(new URI("https://<exchange server>/EWS/exchange.asmx"));
    
    

    hopefully your putting the FQDN of your CAS server in the place of <exchange server> as well

    Cheers
    Glen

    Wednesday, March 16, 2011 3:05 AM
  • Hi Glen,

     

    Thank you for your reply. I am using FQDN in place of <exchange server> and i am using NTLM authentication. I made the change as you suggested but still stuck up with same problem :(

    Can you please give me some sample java code to make connection with NTLM authnetication.

     

     

    Wednesday, March 16, 2011 7:26 AM
  • There is a getting started document with the download on codeplex that has plenty of working code samples is it the connection isn't working or a particular operation thats not ?

    Cheers

    Glen

    Thursday, March 17, 2011 2:38 AM

  • Hi,

    Are you trying to use this API in a web application? Or is it standalone application. If it is standalone application, then it should not be a problem I think. But if you running it as a web application, then put the EWSAPI1.1.jar ( and dependent jars if you are using the new release), into the system classpath and try.

    http://social.technet.microsoft.com/Forums/en-US/exchangesvrdevelopment/thread/484bb22d-1c40-4a5d-ad8e-564fdf8f568e/

     

    Regards,

    Paul
    Thursday, March 17, 2011 1:58 PM
  • Hi Glen,

    Thanks again for your valuable inputs. I will be very much appreciated if you can provide me the links for samples

    Monday, March 21, 2011 6:29 AM