none
Accessing Exchange 2010 SP2 via EWS 2.0 results in Microsoft.Exchange.WebServices.Data.ServiceRequestException: The response received from the service didn't contain valid XML. RRS feed

Answers

  • The problem was with the load balancer. Turned out that the load balancer added a few characters to the front of the result.

    By accessing the Exchange server directly (skipping) the load balancer, we were able to use the Exchange web service properly.


    Computer Science Made Easy

    • Marked as answer by r.heinkens Tuesday, November 20, 2012 12:40 PM
    Tuesday, November 20, 2012 12:40 PM

All replies

  • The problem was with the load balancer. Turned out that the load balancer added a few characters to the front of the result.

    By accessing the Exchange server directly (skipping) the load balancer, we were able to use the Exchange web service properly.


    Computer Science Made Easy

    • Marked as answer by r.heinkens Tuesday, November 20, 2012 12:40 PM
    Tuesday, November 20, 2012 12:40 PM
  • We are seeing similiar in our environment - Exchange 2010 SP2 RU4v2 with an F5 BigIP 1600 in front for load balancing. We only seem to incur the issue when routing through the load balancer.


    Here is a snippet of what we are seeing:

    ad5
    <?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:Serv
    rVersionInfo MajorVersion="14" MinorVersion="2" MajorBuildNumber="318" MinorBuildNumber="4" Version="Exchange2010_SP2"
    mlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/service
    /2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/></s:He
    der><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><m:GetFo
    derResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.co
    /exchange/services/2006/types"><m:ResponseMessages><m:GetFolderResponseMessage ResponseClass="Success"><m:ResponseCode>
    oError</m:ResponseCode><m:Folders><t:Folder><t:FolderId Id="AAMkADFhODg1MmRlLTUwNTAtNGQ3Zi1iYTI3LTM4ODkyZDY3ZTMzZAAuAAA
    AACL9stMRHm4Q7v5wVMuiss0AQCtpH7+FaynTotwK275DZE5AAAF5VyTAAA=" ChangeKey="AQAAABYAAADvUTonVa87SbSkKZ47zNwWAAAQH6tA"/><t:
    arentFolderId Id="AAMkADFhODg1MmRlLTUwNTAtNGQ3Zi1iYTI3LTM4ODkyZDY3ZTMzZAAuAAAAAACL9stMRHm4Q7v5wVMuiss0AQCtpH7+FaynTotwK
    75DZE5AAAF5VySAAA=" ChangeKey="AQAAAA=="/><t:DisplayName>Top of Information Store</t:DisplayName><t:TotalCount>0</t:Tot
    lCount><t:ChildFolderCount>21</t:ChildFolderCount><t:EffectiveRights><t:CreateAssociated>true</t:CreateAssociated><t:Cr
    ateContents>true</t:CreateContents><t:CreateHierarchy>true</t:CreateHierarchy><t:Delete>true</t:Delete><t:Modify>true</
    :Modify><t:Read>true</t:Read><t:ViewPrivateItems>true</t:ViewPrivateItems></t:EffectiveRights><t:PermissionSet><t:Permi
    sions><t:Permission><t:UserId><t:DistinguishedUser>Default</t:DistinguishedUser></t:UserId><t:CanCreateItems>false</t:C
    nCreateItems><t:CanCreateSubFolders>false</t:CanCreateSubFolders><t:IsFolderOwner>false</t:IsFolderOwner><t:IsFolderVis
    ble>false</t:IsFolderVisible><t:IsFolderContact>false</t:IsFolderContact><t:EditItems>None</t:EditItems><t:DeleteItems>
    one</t:DeleteItems><t:ReadItems>None</t:ReadItems><t:PermissionLevel>None</t:PermissionLevel></t:Permission><t:Permissi
    n><t:UserId><t:DistinguishedUser>Anonymous</t:DistinguishedUser></t:UserId><t:CanCreateItems>false</t:CanCreateItems><t
    CanCreateSubFolders>false</t:CanCreateSubFolders><t:IsFolderOwner>false</t:IsFolderOwner><t:IsFolderVisible>false</t:Is
    olderVisible><t:IsFolderContact>false</t:IsFolderContact><t:EditItems>None</t:EditItems><t:DeleteItems>None</t:DeleteIt
    ms><t:ReadItems>None</t:ReadItems><t:PermissionLevel>None</t:PermissionLevel></t:Permission></t:Permissions></t:Permiss
    onSet><t:UnreadCount>0</t:UnreadCount></t:Folder></m:Folders></m:GetFolderResponseMessage></m:ResponseMessages></m:GetF
    lderResponse>
    16
    </s:Body></s:Envelope>
    0

    Basically, the same as yours with characters at the beginning and end. 

    I also am able to get around the issue by going straight to a CAS however most of our EWS clients (Mac Mail, Outlook 2011 for Mac) do not have this workaround available.

    Just curious to see, when did this crop up for you and what load balancer/version of Exchange are you on? It appears the same from the code, just want to verify.

    Regards,

    Brandon

    Tuesday, November 20, 2012 10:20 PM
  • Hi All,

    Same is happening in our environment. When we are using load balancer, we are getting error

    Exception details:
    Message: The response received from the service didn't contain valid XML.
    Type: Microsoft.Exchange.WebServices.Data.ServiceRequestException
    Source: Microsoft.Exchange.WebServices
    Stack Trace:
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadXmlDeclaration(EwsServiceXmlReader reader)
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadSoapFault(EwsServiceXmlReader reader)
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request)
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request)
       at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
       at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
       at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalConvertIds(IEnumerable`1 ids, IdFormat destinationFormat,

    ServiceErrorHandling errorHandling)
       at EWSEditor.Common.Extensions.ExchangeServiceExtensions.TestExchangeService(ExchangeService service) in E:\msft tools\ewseditor

    \EWSEditor\Common\Extensions\ExchangeServiceExtensions.cs:line 171
       at EWSEditor.Exchange.EwsProxyFactory.InitializeWithDefaults(Nullable`1 version, Uri ewsUrl, String autodiscoverAddress) in E:\msft

    tools\ewseditor\EWSEditor\Exchange\EwsProxyFactory.cs:line 257
       at EWSEditor.Exchange.EwsProxyFactory.InitializeWithDefaults() in E:\msft tools\ewseditor\EWSEditor\Exchange

    \EwsProxyFactory.cs:line 218
       at EWSEditor.Forms.FolderTreeForm.OpenDefaultExchangeServiceMenu_Click(Object sender, EventArgs e) in E:\msft tools\ewseditor

    \EWSEditor\Forms\FolderTreeForm.cs:line 582
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    Exception details:
    Message: Data at the root level is invalid. Line 1, position 1.
    Type: System.Xml.XmlException
    Source: System.Xml
    Stack Trace:
       at System.Xml.XmlTextReaderImpl.Throw(Exception e)
       at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
       at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
       at System.Xml.XmlCharCheckingReader.Read()
       at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read()
       at Microsoft.Exchange.WebServices.Data.EwsXmlReader.Read(XmlNodeType nodeType)
       at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ReadXmlDeclaration(EwsServiceXmlReader reader)

    But when we are directly pointing to CAS servers EWS works. We can not rule out load balancer and request has to go via it.

    Please let us know how to get it working with Load Balancer.

    Any update/response will be helpful

    Thanks!!

    Tuesday, July 15, 2014 11:32 AM
  • It's been a while since we had this issue, but the we fixed it by applying the latest update for our F5 1600. 
    Tuesday, July 15, 2014 11:34 AM