EWS client built for Exchange 2007 no longer working since moving to Exchange 2013

Hello, 

I have an EWS client built in JAVA which calls the GetUserAvailability and CreateItem operations. SOAP requests are sent over HTTPS. A service account is supplied which satisfies authentication challenges.

The client was built against Exchange Server 2007. Now the infrastructure is moving to Exchange 2013. Initially testing has surfaced an issue connecting and fetching FREEBUSY data from Exchange 2013. 

Exchange 2013 returns a 400 exception when I attempt to fetch FREEBUSY data for an existing mailbox. The same client returns data when pointed against the 2007 server. 

Can someone advise if the SOAP request for Exchange 2013 requires some additional header information ( compared to 2007 request)? 

Including a copy of the request i send incase someone sees something which i should change

<?xml version="1.0" encoding="utf-8" ?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
	<SOAP-ENV:Body xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
		<GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">
			<TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
				<Bias>0</Bias>
				<StandardTime>
					<Bias>0</Bias>
					<Time>01:00:00</Time>
					<DayOrder>4</DayOrder>
					<Month>10</Month>
					<DayOfWeek>Sunday</DayOfWeek>
				</StandardTime>
				<DaylightTime>
					<Bias>0</Bias>
					<Time>01:00:00</Time>
					<DayOrder>4</DayOrder>
					<Month>3</Month>
					<DayOfWeek>Sunday</DayOfWeek>
				</DaylightTime>
			</TimeZone>
			<MailboxDataArray>
				<MailboxData xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
					<Email>
						<Name/>
						<Address>adress@example.com</Address>
						<RoutingType>SMTP</RoutingType>
					</Email>
					<AttendeeType>Required</AttendeeType>
					<ExcludeConflicts>false</ExcludeConflicts>
				</MailboxData>
			</MailboxDataArray>
			<FreeBusyViewOptions xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
				<TimeWindow>
					<StartTime>2015-08-29T14:00:00.000Z</StartTime>
					<EndTime>2015-08-29T16:00:00.000Z</EndTime>
				</TimeWindow>
				<MergedFreeBusyIntervalInMinutes>30</MergedFreeBusyIntervalInMinutes>
				<RequestedView>FreeBusy</RequestedView>
			</FreeBusyViewOptions>
		</GetUserAvailabilityRequest>
	</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 


June 29th, 2015 7:35pm

**Update: I've tested this request in both Fiddler and EWS Editor and it succeeds on both platforms. The request headers, content type etc all look the same. Is it possible that Fiddler and EWS Editor are able to handler redirects which may be happening when i hit the load balanced URL?

The response is include below; It's not a SOAP response just HTTP 400. 

The exact request works when using the EWS Editor but not through my HTTPClient (which successfully sends/receives 2007 requests)

I also receive the following message when initially setting up the EWS Editor - The mailbox that was requested doesn't support the specified RequestServerVersion

Exception details:
Message: The mailbox that was requested doesn't support the specified RequestServerVersion.
Type: Microsoft.Exchange.WebServices.Data.ServiceResponseException
Source: Microsoft.Exchange.WebServices
ErrorCode: ErrorInvalidSchemaVersionForMailboxVersion
ErrorMessage: The mailbox that was requested doesn't support the specified RequestServerVersion.

30-Jun-2015 09:33:39 com.sun.jersey.api.client.filter.LoggingFilter log
INFO: 1 * Client in-bound response
1 < 400
1 < Cache-Control: private
1 < Server: Microsoft-IIS/8.0
1 < request-id: bbe********************************
1 < X-CalculatedBETarget: msg******.somedoamin.com
1 < X-DiagInfo: MSG**********
1 < X-BEServer: MSG**********
1 < X-AspNet-Version: 4.0.30319
1 < Set-Cookie: exchangecookie=*************************; expires=Thu, 30-Jun-2016 08:33:40 GMT; path=/; HttpOnly
1 < Set-Cookie: X-BackEndCookie=*********************; expires=Thu, 30-Jul-2015 12:33:40 GMT; path=/ews; secure; HttpOnly
1 < Persistent-Auth: true
1 < X-Powered-By: ASP.NET
1 < X-FEServer: MSG******
1 < Date: Tue, 30 Jun 2015 08:33:40 GMT
1 < Content-Length: 0
1 < 



  • Edited by colinduggan Tuesday, June 30, 2015 11:19 AM
Free Windows Admin Tool Kit Click here and download it now
June 30th, 2015 8:40am

Thanks, yes it does appear to be a http client configuration issue. The content size in the request is 0. I modified my request to try negotiate and kerberos ahead of ntlm as recommended in an earlier article (msdn related).

This client works as expected against EWS 2007. I've included the NTLM challenge below. Can you advise if there is anything amiss here?

"POST /EWS/Exchange.asmx HTTP/1.1[\r][\n]"
 ]  >> "Content-Type: text/xml; charset=utf-8[\r][\n]"
 ]  >> "Accept-Encoding: gzip,deflate[\r][\n]"
 ]  >> "Host: ewsserver.com[\r][\n]"
 ]  >> "Keep-Alive: 300[\r][\n]"
 ]  >> "Accept: text/xml[\r][\n]"
 ]  >> "Transfer-Encoding: chunked[\r][\n]"
 ]  >> "Connection: Keep-Alive[\r][\n]"
 ]  >> "User-Agent: Apache-HttpClient/4.4 (Java/1.6.0_45)[\r][\n]"
 ]  >> "Cookie: ClientId=MODXBXIZKQWCNWZZBAMG[\r][\n]"
 ]  >> "Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEgAAADgAOAAYAAAAAgACABAAQAADgAOAEgBAAAOAA4AVgEAAAAAAABkAQAABYKIogUBKAoAAAAPpq/uARFpiR+HgdxeFrDs+Tvv1FcX41et/iAutQu2ZvEyYgnODYUzGgEBAAAAAAAAIFClSIO60AHQ3ki9vLYtzAAAAAACAAgARABNAE4AMQABABoATQBTAEcAUgBUAFAAMQBEAEEARwAwADEAQwAEABgARABNAE4AMQAuAEYATQBSAC4AYwBvAG0AAwA0AE0AUwBHAFIAVABQADEARABBAEcAMAAxAEMALgBEAE0ATgAxAC4ARgBNAFIALgBjAG8AbQAFAB4AVwBJAE4AUgBPAE8AVAAuAEYATQBSAC4AYwBvAG0ABwAIALwNE0mDutABAAAAAAAAAABEAE0ATgAxAGEAMwA4ADIAOAA0ADEAVgAwADAAMQA1ADUANgA=[\r][\n]"
 ]  >> "[\r][\n]"
>> POST /EWS/Exchange.asmx HTTP/1.1
>> Content-Type: text/xml; charset=utf-8
>> Accept-Encoding: gzip,deflate
>> Host: ewsserver.com
>> Keep-Alive: 300
> Accept: text/xml
>> Transfer-Encoding: chunked
>> Connection: Keep-Alive
>> User-Agent: Apache-HttpClient/4.4 (Java/1.6.0_45)
> Cookie: ClientId=MODXBXIZKQWCNWZZBAMG
 >> Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEgAAADgAOAAYAAAAAgACABAAQAADgAOAEgBAAAOAA4AVgEAAAAAAABkAQAABYKIogUBKAoAAAAPpq/uARFpiR+HgdxeFrDs+Tvv1FcX41et/iAutQu2ZvEyYgnODYUzGgEBAAAAAAAAIFClSIO60AHQ3ki9vLYtzAAAAAACAAgARABNAE4AMQABABoATQBTAEcAUgBUAFAAMQBEAEEARwAwADEAQwAEABgARABNAE4AMQAuAEYATQBSAC4AYwBvAG0AAwA0AE0AUwBHAFIAVABQADEARABBAEcAMAAxAEMALgBEAE0ATgAxAC4ARgBNAFIALgBjAG8AbQAFAB4AVwBJAE4AUgBPAE8AVAAuAEYATQBSAC4AYwBvAG0ABwAIALwNE0mDutABAAAAAAAAAABEAE0ATgAxAGEAMwA4ADIAOAA0ADEAVgAwADAAMQA1ADUANgA=

INFO: 1 * Client out-bound request
1 > POST https://ewsserver.com/EWS/Exchange.asmx
1 > Content-Type: text/xml; charset=utf-8
1 > Accept-Encoding: gzip,deflate
1 > Host: ewsserver.com
1 > Keep-Alive: 300
1 > Accept: text/xml
1 > 
 ]  >> "60d[\r][\n]"
>> "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Header><RequestServerVersion Version="Exchange2010_SP2"/></soap:Header><soap:Body><GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"><t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:Bias>0</t:Bias><StandardTime><t:Bias>0</t:Bias><t:Time>01:00:00</t:Time><t:DayOrder>4</t:DayOrder><t:Month>10</t:Month><t:DayOfWeek>Sunday</t:DayOfWeek></StandardTime><t:DaylightTime><t:Bias>0</t:Bias><t:Time>01:00:00</t:Time><t:DayOrder>4</t:DayOrder><t:Month>3</t:Month><t:DayOfWeek>Sunday</t:DayOfWeek></t:DaylightTime></t:TimeZone><m:MailboxDataArray><t:MailboxData xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:Email><t:Address>testcontent@fmr.com</t:Address></t:Email><t:AttendeeType>Required</t:AttendeeType><t:ExcludeConflicts>false</t:ExcludeConflicts></t:MailboxData></m:MailboxDataArray><t:FreeBusyViewOptions xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:TimeWindow><t:StartTime>2015-07-09T00:00:00</t:StartTime><t:EndTime>2015-07-10T00:00:00</t:EndTime></t:TimeWindow><t:MergedFreeBusyIntervalInMinutes>30</t:MergedFreeBusyIntervalInMinutes><t:RequestedView>Detailed</t:RequestedView></t:FreeBusyViewOptions></GetUserAvailabilityRequest></soap:Body></soap:Envelope>"
 ]  >> "[\r][\n]"
 ]  >> "0[\r][\n]"
 ]  >> "[\r][\n]"
 ]  << "HTTP/1.1 400 Bad Request[\r][\n]"
 ]  << "Cache-Control: private[\r][\n]"
 ]  << "Server: Microsoft-IIS/8.0[\r][\n]"
 ]  << "request-id: 893b713f-e496-46e1-bee3-b08afb58ca71[\r][\n]"
 ]  << "X-CalculatedBETarget: server.domain.com[\r][\n]"
 ]  << "X-DiagInfo: MSGRT*********[\r][\n]"
 ]  << "X-BEServer: MSGRT*********[\r][\n]"
 ]  << "X-AspNet-Version: 4.0.30319[\r][\n]"
 ]  << "Set-Cookie: exchangecookie=bab1b99b95e04d98bb72078bbe46395e; expires=Sat, 09-Jul-2016 20:10:22 GMT; path=/; HttpOnly[\r][\n]"
 ]  << "Set-Cookie: X-BackEndCookie=S-1-5-21-1343024091-606747145-1801674531-111254=u56Lnp2ejJqBncedm8bGms7Sy8nMytLLyZmd0sfLzsnSzZuZycqbys/Inp6bgYHNz87K0s/H0s/Hq83Pxc7Pxc3N; expires=Sun, 09-Aug-2015 00:10:22 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
 ]  << "Persistent-Auth: true[\r][\n]"
 ]  << "X-Powered-By: ASP.NET[\r][\n]"
 ]  << "X-FEServer: MSGRT*********[\r][\n]"
 ]  << "Date: Thu, 09 Jul 2015 20:10:21 GMT[\r][\n]"
 ]  << "Content-Length: 0[\r][\n]"
 ]  << "[\r][\n]"



July 9th, 2015 4:25pm

Thanks, yes it does appear to be a http client configuration issue. The content size in the request is 0. I modified my request to try negotiate and kerberos ahead of ntlm as recommended in an earlier article (msdn related).

This client works as expected against EWS 2007. I've included the NTLM challenge below. Can you advise if there is anything amiss here?

"POST /EWS/Exchange.asmx HTTP/1.1[\r][\n]"
 ]  >> "Content-Type: text/xml; charset=utf-8[\r][\n]"
 ]  >> "Accept-Encoding: gzip,deflate[\r][\n]"
 ]  >> "Host: ewsserver.com[\r][\n]"
 ]  >> "Keep-Alive: 300[\r][\n]"
 ]  >> "Accept: text/xml[\r][\n]"
 ]  >> "Transfer-Encoding: chunked[\r][\n]"
 ]  >> "Connection: Keep-Alive[\r][\n]"
 ]  >> "User-Agent: Apache-HttpClient/4.4 (Java/1.6.0_45)[\r][\n]"
 ]  >> "Cookie: ClientId=MODXBXIZKQWCNWZZBAMG[\r][\n]"
 ]  >> "Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEgAAADgAOAAYAAAAAgACABAAQAADgAOAEgBAAAOAA4AVgEAAAAAAABkAQAABYKIogUBKAoAAAAPpq/uARFpiR+HgdxeFrDs+Tvv1FcX41et/iAutQu2ZvEyYgnODYUzGgEBAAAAAAAAIFClSIO60AHQ3ki9vLYtzAAAAAACAAgARABNAE4AMQABABoATQBTAEcAUgBUAFAAMQBEAEEARwAwADEAQwAEABgARABNAE4AMQAuAEYATQBSAC4AYwBvAG0AAwA0AE0AUwBHAFIAVABQADEARABBAEcAMAAxAEMALgBEAE0ATgAxAC4ARgBNAFIALgBjAG8AbQAFAB4AVwBJAE4AUgBPAE8AVAAuAEYATQBSAC4AYwBvAG0ABwAIALwNE0mDutABAAAAAAAAAABEAE0ATgAxAGEAMwA4ADIAOAA0ADEAVgAwADAAMQA1ADUANgA=[\r][\n]"
 ]  >> "[\r][\n]"
>> POST /EWS/Exchange.asmx HTTP/1.1
>> Content-Type: text/xml; charset=utf-8
>> Accept-Encoding: gzip,deflate
>> Host: ewsserver.com
>> Keep-Alive: 300
> Accept: text/xml
>> Transfer-Encoding: chunked
>> Connection: Keep-Alive
>> User-Agent: Apache-HttpClient/4.4 (Java/1.6.0_45)
> Cookie: ClientId=MODXBXIZKQWCNWZZBAMG
 >> Authorization: NTLM TlRMTVNTUAADAAAAGAAYAEgAAADgAOAAYAAAAAgACABAAQAADgAOAEgBAAAOAA4AVgEAAAAAAABkAQAABYKIogUBKAoAAAAPpq/uARFpiR+HgdxeFrDs+Tvv1FcX41et/iAutQu2ZvEyYgnODYUzGgEBAAAAAAAAIFClSIO60AHQ3ki9vLYtzAAAAAACAAgARABNAE4AMQABABoATQBTAEcAUgBUAFAAMQBEAEEARwAwADEAQwAEABgARABNAE4AMQAuAEYATQBSAC4AYwBvAG0AAwA0AE0AUwBHAFIAVABQADEARABBAEcAMAAxAEMALgBEAE0ATgAxAC4ARgBNAFIALgBjAG8AbQAFAB4AVwBJAE4AUgBPAE8AVAAuAEYATQBSAC4AYwBvAG0ABwAIALwNE0mDutABAAAAAAAAAABEAE0ATgAxAGEAMwA4ADIAOAA0ADEAVgAwADAAMQA1ADUANgA=

INFO: 1 * Client out-bound request
1 > POST https://ewsserver.com/EWS/Exchange.asmx
1 > Content-Type: text/xml; charset=utf-8
1 > Accept-Encoding: gzip,deflate
1 > Host: ewsserver.com
1 > Keep-Alive: 300
1 > Accept: text/xml
1 > 
 ]  >> "60d[\r][\n]"
>> "<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Header><RequestServerVersion Version="Exchange2010_SP2"/></soap:Header><soap:Body><GetUserAvailabilityRequest xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"><t:TimeZone xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:Bias>0</t:Bias><StandardTime><t:Bias>0</t:Bias><t:Time>01:00:00</t:Time><t:DayOrder>4</t:DayOrder><t:Month>10</t:Month><t:DayOfWeek>Sunday</t:DayOfWeek></StandardTime><t:DaylightTime><t:Bias>0</t:Bias><t:Time>01:00:00</t:Time><t:DayOrder>4</t:DayOrder><t:Month>3</t:Month><t:DayOfWeek>Sunday</t:DayOfWeek></t:DaylightTime></t:TimeZone><m:MailboxDataArray><t:MailboxData xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:Email><t:Address>testcontent@fmr.com</t:Address></t:Email><t:AttendeeType>Required</t:AttendeeType><t:ExcludeConflicts>false</t:ExcludeConflicts></t:MailboxData></m:MailboxDataArray><t:FreeBusyViewOptions xmlns="http://schemas.microsoft.com/exchange/services/2006/types"><t:TimeWindow><t:StartTime>2015-07-09T00:00:00</t:StartTime><t:EndTime>2015-07-10T00:00:00</t:EndTime></t:TimeWindow><t:MergedFreeBusyIntervalInMinutes>30</t:MergedFreeBusyIntervalInMinutes><t:RequestedView>Detailed</t:RequestedView></t:FreeBusyViewOptions></GetUserAvailabilityRequest></soap:Body></soap:Envelope>"
 ]  >> "[\r][\n]"
 ]  >> "0[\r][\n]"
 ]  >> "[\r][\n]"
 ]  << "HTTP/1.1 400 Bad Request[\r][\n]"
 ]  << "Cache-Control: private[\r][\n]"
 ]  << "Server: Microsoft-IIS/8.0[\r][\n]"
 ]  << "request-id: 893b713f-e496-46e1-bee3-b08afb58ca71[\r][\n]"
 ]  << "X-CalculatedBETarget: server.domain.com[\r][\n]"
 ]  << "X-DiagInfo: MSGRT*********[\r][\n]"
 ]  << "X-BEServer: MSGRT*********[\r][\n]"
 ]  << "X-AspNet-Version: 4.0.30319[\r][\n]"
 ]  << "Set-Cookie: exchangecookie=bab1b99b95e04d98bb72078bbe46395e; expires=Sat, 09-Jul-2016 20:10:22 GMT; path=/; HttpOnly[\r][\n]"
 ]  << "Set-Cookie: X-BackEndCookie=S-1-5-21-1343024091-606747145-1801674531-111254=u56Lnp2ejJqBncedm8bGms7Sy8nMytLLyZmd0sfLzsnSzZuZycqbys/Inp6bgYHNz87K0s/H0s/Hq83Pxc7Pxc3N; expires=Sun, 09-Aug-2015 00:10:22 GMT; path=/EWS; secure; HttpOnly[\r][\n]"
 ]  << "Persistent-Auth: true[\r][\n]"
 ]  << "X-Powered-By: ASP.NET[\r][\n]"
 ]  << "X-FEServer: MSGRT*********[\r][\n]"
 ]  << "Date: Thu, 09 Jul 2015 20:10:21 GMT[\r][\n]"
 ]  << "Content-Length: 0[\r][\n]"
 ]  << "[\r][\n]"



  • Edited by colinduggan Thursday, July 09, 2015 8:26 PM
Free Windows Admin Tool Kit Click here and download it now
July 9th, 2015 8:23pm

It sounds like you NTLM authorization is failing you should be getting a 200 at some point eg http://blogs.msdn.com/b/chiranth/archive/2013/09/21/ntlm-want-to-know-how-it-works.aspx maybe https://issues.apache.org/jira/browse/HTTPCLIENT-1363 is affecting you ?

Cheers
Glen

July 10th, 2015 1:57am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics