When setting up an Exchange Integration in CRM, an error may occur at the second stage of the set up process ("The Sync Engine is checking to see if the Exchange Web Service is available").
At this step, the synch engine is trying to verify that it can connect to the EWS endpoint, and authenticate using the credentials supplied on the previous screen. You may see an error in the exchangesynch.log file, describing an error that has been returned by Exchange:
The request is invalid., action: ESTABLISHING_CONNECTION_EWS_ENDPOINT
A related error may appear in the ewaresystem.log:
Apr 21 2014 14:26:41.743 6804 5300 5 ERROR: checkExchangeUserEmail
URL : http://CRM-SERVER/sdata/crmExchangeSyncEngine/crmExchange/-/$service/checkExchangeWebSiteAvailability?url_ews=https%3A%2F%2Fexchange-server%2Fews%2Fexchange.asmx&user_ews=crm&password_ews=%26HGBMDJMEAJBABICGICHCJEFGKEJHDJBO&domain_ews=test.com&crmuser=Admin
MSG : <CheckExchangeResponse><errorMessage>com.sage.scrm.syncengine.exchange.ews.service.error.SageExchangeServiceException: javax.xml.ws.soap.SOAPFaultException: The request is invalid.</errorMessage><httpStatus>400</httpStatus></CheckExchangeResponse>
The Fiddler HTTP debugger can be used to try to find the correct Exchange Server User Name that should be used when setting up the integration.
- Download and open the Fiddler web debugger.
- Click on the Composer tab.
- Basic Authentication is used to authenticate against the Exchange EWS endpoint. As such, we will need to encode the Exchange server username and password in the format of username:password using Base64 encoding. An example Base64-encoded string is as follows:
firstname.lastname@example.org:password will be encoded as: Y3JtQHRlc3QuY29tOnBhc3N3b3Jk
Base64 encoders are available online. However, since the data being encoded is sensitive, you may prefer to use a standalone application. A simple Base64 encoder is available by searching for KBA 492-17225. Alternatively, it can be downloaded here.
- Change the HTTP Verb from GET to POST
- Change the url in the address bar to the Exchange Web Service URL.
- Add the following information to the Request Headers section of the Fiddler composer:
Authorization: Basic Y3JtQHRlc3QuY29tOnBhc3N3b3Jk
8. Add the following information to the request body section:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><RequestServerVersion xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" Version="Exchange2007_SP1" /></soap:Header><soap:Body><ns2:ResolveNames xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ns2="http://schemas.microsoft.com/exchange/services/2006/messages" ReturnFullContactData="false"><ns2:UnresolvedEntry> email@example.com</ns2:UnresolvedEntry></ns2:ResolveNames></soap:Body></soap:Envelope>
9. Click on Execute to send the request
If you click on the Inspectors tab in Fiddler you will able to see the xml that has been returned by Exchange in response to your request. Based on this response you should be able to tell what the issue with the user is. Using this method, you can quickly alter the request to try different combinations of usernames & domains or indeed different users.
This method mimics the request that CRM sends to Exchange during the sync set up process.
It allows you to quickly alter the username and password you are using to authenticate with the EWS and allows you to quickly see the response being returned from exchange for each request.
For example, the following response may be returned:
“When making a request as an account that does not have a mailbox, you must specify the mailbox primary SMTP address for any distinguished folder Ids.”
What this error is telling us is that Exchange cannot find a valid Exchange user based on the details of the Exchange Server User Name specified on the Exchange Integration Connection Management screen.
If the above error is returned, and a valid primary SMTP address does exist for this Exchange user, you should check that the user is not hidden from the Global Address List in Exchange. The GAL is the list that the ResolveNames function used by CRM looks up to try to find the Exchange user.
You also need to make sure that the user's primary SMTP address matches the username and domain used to access the user's mailbox through outlook web access (OWA). For example, if the user logs in to OWA using the credentials test\crm, then the user's primary SMTP address in exchange should be user@test.