I developed a Java interface that connects to a Exchange Web Services and it works until I perform request.
My problem is that the answers are always empty. For example, if I send the following query to a 2007 exchange server:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\">"
<soap:Header>
<t:RequestServerVersion Version=\"Exchange2007\"/>"
</soap:Header>"
<soap:Body>"
<FindItem xmlns=\"http://schemas.microsoft.com/exchange/services/2006/messages\" xmlns:t=\"http://schemas.microsoft.com/exchange/services/2006/types\" Traversal=\"Shallow\">"
<ItemShape>"
<t:BaseShape>IdOnly</t:BaseShape>"
</ItemShape>
<ParentFolderIds>
<t:FolderId Id="inbox" />
</ParentFolderIds>"
</FindItem>
</soap:Body>
</soap:Envelope>
The answer I get at the end is a simple normal HTTP packet without any error. Here is its contents (I did some System.out to output this):
################ANSWER################
#Header : Date: Thu, 09 Aug 2012 09:36:53 GMT#
#Header : Server: Microsoft-IIS/6.0#
#Header : X-Powered-By: ASP.NET#
#Header : X-AspNet-Version: 2.0.50727#
#Header : Cache-Control: private#
#Header : Content-Length: 0#
################DATA################
Data :
As you can see, the length of the content is empty. It seems that the server accepts the request, do something with it, and replies an empty result.
Do you have an idea why?
Thx!
I found the mighty trick that solves everything. The most important and ONLY REQUIRED header of the HTTP post message that you send to the server is the
Content-Typevalue. Every other header is optional and i’m not even sure they are used for anything. TheContent-Typeis the key that unlocks everything.