none
[E2007] [EWS Java API 1.1][JAVA] - Getting internal server error. RRS feed

  • Question

  • Hi,

    I am trying to use EWS with e2007 server. I tried the below sample for just getting the id of the Inbox folder of user.

    <!-- [if gte mso 10]> <mce:style>

        System.setProperty( "javax.net.ssl.trustStore", "C:\\Java\\jdk1.6.0_20\\jre\\lib\\security\\cacerts" );
    
        System.setProperty( "javax.net.ssl.trustStorePassword", "changeit" );
        ExchangeService service = new ExchangeService();
        URI url = new URI( "https://e2007/ews/Exchange.asmx" );
        service.setUrl( url );
        service.setCredentials( new WebCredentials( "regressionuser1", "P@$$w0rd" ) );
        System.out.println( "Created ExchangeService" );
        service.setTraceEnabled( true );
        Folder folder = Folder.bind( service, WellKnownFolderName.Inbox, PropertySet.IdOnly );
        System.out.println( folder.getId() );
        service.setTraceEnabled( false );
    

    When I do this operation, I am getting the following exception.

    Exception in thread "main" microsoft.exchange.webservices.data.ServiceRequestException: The request failed. Connection Error java.io.IOException: Server returned HTTP response code: 500 for URL: https://e2007/ews/Exchange.asmx
    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:52)
    at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:140)
    at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:349)
    at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:374)
    at microsoft.exchange.webservices.data.Folder.bind(Folder.java:49)
    at microsoft.exchange.webservices.data.Folder.bind(Folder.java:90)
    at test.FolderTest.main(FolderTest.java:24)
    Caused by: microsoft.exchange.webservices.data.EWSHttpException: Connection Error java.io.IOException: Server returned HTTP response code: 500 for URL: https://e2007/ews/Exchange.asmx
    at microsoft.exchange.webservices.data.HttpNativeWebRequest.getInputStream(HttpNativeWebRequest.java:145)
    at microsoft.exchange.webservices.data.ServiceRequestBase.getResponseStream(ServiceRequestBase.java:351)
    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.readResponse(SimpleServiceRequestBase.java:74)
    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:39)
    ... 6 more

    This is not an authentication problem or https certificate problem. The error is saying the response code is 500. I think it is an internal server error.

    I checked the logs from Event Viewer/Application and found this error.

    The RPC over HTTP Proxy component is not installed or is not configured correctly. Use the Windows Component Wizard to add the RPC over HTTP Proxy component to the Networking Services.
    
    For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
    

    Is this the problem for EWS not working? Is it a configuration issue in Exchange Server 2007? If it is could you please give post which I can follow to configure "RPC over HTTP Proxy component"?

    Thanks & Regards,

    Paul

          


    Monday, March 7, 2011 5:35 AM

All replies

  • It is a little urgent. If anyone has any idea, please help me.

    Thanks,

    Paul

    Monday, March 7, 2011 12:53 PM
  • Instead of using certificates and all, I used the code from "Getting Started.rtf" guide that comes with EWSAPI1.1.zip release.

    // The trust all certs.
      private static TrustManager [] trustAllCerts = new TrustManager []
      { new X509TrustManager()
      {
        public java.security.cert.X509Certificate[] getAcceptedIssuers()
        {
          return null;
        }
    
        public void checkClientTrusted( java.security.cert.X509Certificate[] certs, String authType )
        {
        }
    
        public void checkServerTrusted( java.security.cert.X509Certificate[] certs, String authType )
        {
        }
      } };
    
      // Java Secure Socket Connection
      private static HostnameVerifier hv = new HostnameVerifier()
      {
        public boolean verify( String urlHostName, SSLSession session )
        {
          return true;
        }
      };
    
      // Sets the ssl config.
      private static void setSSLConfig() throws Exception
      {
        SSLContext context = SSLContext.getInstance( "SSL" );
        context.init( null, trustAllCerts, new java.security.SecureRandom() );
        HttpsURLConnection.setDefaultSSLSocketFactory( context.getSocketFactory() );
        HttpsURLConnection.setDefaultHostnameVerifier( hv );
      }
    Still the error is same.

     

    Tuesday, March 8, 2011 9:11 AM
  • Hi,

    I installed "RPC over HTTP Proxy component" from Add/Remove windows components.

    In IIS manager, I modified the directory security of the EWS web site from "NTLM authentication" to "Basic Authentication". Now if I try the test case, the exception message is changed. The new exception message is:

    Exception in thread "main" microsoft.exchange.webservices.data.ServiceRequestException: The request failed. Connection Error java.net.ProtocolException: Server redirected too many times (20)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:52)
    	at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:140)
    	at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:349)
    	at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:374)
    	at microsoft.exchange.webservices.data.Folder.bind(Folder.java:49)
    	at microsoft.exchange.webservices.data.Folder.bind(Folder.java:90)
    	at test.FolderTest.main(FolderTest.java:33)
    Caused by: microsoft.exchange.webservices.data.EWSHttpException: Connection Error java.net.ProtocolException: Server redirected too many times (20)
    	at microsoft.exchange.webservices.data.HttpNativeWebRequest.getInputStream(HttpNativeWebRequest.java:145)
    	at microsoft.exchange.webservices.data.ServiceRequestBase.getResponseStream(ServiceRequestBase.java:351)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.readResponse(SimpleServiceRequestBase.java:74)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:39)
    	... 6 more
    

    But I am sure that the IP, username and password are correct.

    I can login to OWA using the same credentials. No issues there.

    Is there anything additional that should be done to get EWS working in e2007? Please help to get EWS working in e2007 server.

     

    In http://archive.msdn.microsoft.com/ewsjavaapi, I read that "Java implementation of the Exchange Web Services (EWS) API. This API gives developers programmatic access to Exchange Server 2007 SP1 and above.". I thought, maybe the exchange server installed here is not SP1.

    The details of the Exchange server from Exchange Management Console "Help >  About Exchange Server 2007" is:

    Exchange Server 2007
    
    Microsoft Corporation
    
    Version: 08.03.0083.000

    I didnt find this version directly from http://support.microsoft.com/kb/158530. But found the entry

    Microsoft Exchange Server 2007 SP3         8.3.0083.006
    June 2010

    I think the build installed is SP3.

     

    If anyone have any idea what could be the problem, please help.

    Thanks,

    Paul

     

    Tuesday, March 8, 2011 9:38 AM
  • Hi Paul, Thanks for reporting the issue.This is not an authentication or https certificate problem.Please try with the code


                ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1) instead of

                ExchangeService service = new ExchangeService();
                    
    Please get back to us ,if still the problem is not resolved.

    Friday, June 17, 2011 10:53 AM
  • Hi Paul,

    I'm actually getting the same error. Trace shows that the full error (at least in my program) is

    500: Error:The function requested is not supported.

    This is an issue that seems to spring up all over the web in connection IIS6 servers. Support is given by Microsoft here:

    http://support.microsoft.com/kb/903071

    I've yet to verify that this is the cause of my issues, but so far everything seems to point to this.

    Hope that's of some help.

     

    Thursday, July 14, 2011 9:16 AM