none
Unexpected end of XML document exception RRS feed

  • Question

  • Hi, I am getting into serious trouble with Exchange 2007 SP3 and latest EWS API 1.1 (previous did not work either).

    Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
       v Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(HttpWebRequest& request)
       v Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
       v Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
       v Microsoft.Exchange.WebServices.Data.ExchangeService.InternalFindFolders(IEnumerable`1 parentFolderIds, SearchFilter searchFilter, FolderView view, ServiceErrorHandling errorHandlingMode)
       v Microsoft.Exchange.WebServices.Data.ExchangeService.FindFolders(FolderId parentFolderId, FolderView view)

    When I call FindFolders it returns exception "Unexpected end of XML file".

    Thursday, December 9, 2010 11:27 AM

Answers

  • Hello Jirka_,

    The issue is not with the code (at this point) but rather with your Exchange environment. I suspect the issue is with "Mailboxes are on both - Exchange 2007 and 2003". If the Client Access server is trying to service EWS requests for a mailbox that is on 2003, it will not work. Can you tell me whether the Client Access server indicates that it is servicing a 2003 mailbox? 

    With regards,

     


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Jirka_ Friday, October 14, 2011 1:59 PM
    Wednesday, December 15, 2010 5:02 PM
    Moderator

All replies

  • Hello Jirka_,

    Can you provide us more information? Here is strongly suggested information from the Exchange Development Forum Guide that you should provide in your post so that it can be answered:

    Scenario description: Describe the scenario that results in you posting a question to this forum. More information is better. Here are some considerations for describing your scenario:

    Particularly, make sure you provide the request/response XML.

    With regards,

    • Give a thorough description of what you are trying to do and how you are attempting to do it. Provide the steps you have already attempted.
    • Identify resources you've tried to use (include links)
    • Identify the target platforms
    • Provide a code example that describes the problem (as long as it does not reveal sensitive information.)
    • Give a description of the environment for client and server hardware and software. Firewalls, proxy, trusts, security models, system architecture and other environmental factors can have programmability implications.
    • Provide error codes.
    • Provide log entries and traces as long as they do not reveal sensitive information.
    • List the specific questions that you want answered.

    Michael | Microsoft Exchange SDK
    Thursday, December 9, 2010 6:47 PM
    Moderator
  • Hello,

    we have Exchange 2003 and Exchange 2007 sharing same Active directory service.We backed up one user's data into PST on Exchange 2003 and then we imported it to Exchange 2007. Then we connect to Exchange 2007 using EWS 1.1 (final), we are able to read mailboxes of users that were created via Exchange 2007, but we are not able to read mailboxes of users that were created via Exchange 2003. All users are present on both Exhcange 2007 and 2003. Here is XML request/response (*****@*****.***** replaces valid email address for privacy):

    <Trace Tag="EwsRequest" Tid="5" Time="2010-12-10 10:05:43Z" Version="14.02.0051.000">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
        <soap:Header>
          <t:RequestServerVersion Version="Exchange2007_SP1" />
          <t:TimeZoneContext>
            <t:TimeZoneDefinition Id="UTC" />
          </t:TimeZoneContext>
          <t:ExchangeImpersonation>
            <t:ConnectingSID>
              <t:PrimarySmtpAddress>*****@*****.*****</t:PrimarySmtpAddress>
            </t:ConnectingSID>
          </t:ExchangeImpersonation>
        </soap:Header>
        <soap:Body>
          <m:FindFolder Traversal="Shallow">
            <m:FolderShape>
              <t:BaseShape>AllProperties</t:BaseShape>
            </m:FolderShape>
            <m:IndexedPageFolderView MaxEntriesReturned="1" Offset="0" BasePoint="Beginning" />
            <m:ParentFolderIds>
              <t:DistinguishedFolderId Id="msgfolderroot">
                <t:Mailbox>
                  <t:EmailAddress>*****@*****.*****</t:EmailAddress>
                </t:Mailbox>
              </t:DistinguishedFolderId>
            </m:ParentFolderIds>
          </m:FindFolder>
        </soap:Body>
      </soap:Envelope>
    </Trace>

    <Trace Tag="EwsResponse" Tid="5" Time="2010-12-10 10:05:44Z" Version="14.02.0051.000">
      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <soap:Header>
          <t:ServerVersionInfo MajorVersion="8" MinorVersion="3" MajorBuildNumber="83" MinorBuildNumber="4" Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
        </soap:Header>
        <soap:Body>
          <soap:Fault>
            <faultcode>soap:Server</faultcode>
            <faultstring>An internal server error occurred.</faultstring>
            <detail />
          </soap:Fault>
        </soap:Body>
      </soap:Envelope>
    </Trace>

    Stack trace follows:

    in Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ProcessWebException(WebException webException)
    in Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(HttpWebRequest& request)
    in Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute()
    in Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute()
    in Microsoft.Exchange.WebServices.Data.ExchangeService.InternalFindFolders(IEnumerable`1 parentFolderIds, SearchFilter searchFilter, FolderView view, ServiceErrorHandling errorHandlingMode)
    in Microsoft.Exchange.WebServices.Data.ExchangeService.FindFolders(FolderId parentFolderId, FolderView view)

    Exception we get is: Unexpected end of XML document.

    There are no proxies, nor firewall between Exchange 2003, Exchange 2007, Active directory service and our application. All run on local network.

    Exchange 2007 (with SP3): Windows Server 2003 32b

    Exchange 2003 + Active directory: Windows Server 2003 32b

    EWS Application: Windows Server 2008 R2 64b

    Friday, December 10, 2010 11:14 AM
  • Hello Jirka_,

    I'm not certain but I see two potential issues. Are the mailboxes you are trying to access on Exchange 2003? If they are, then this will not work. The Mailbox server and Client Access server need to both be Exchange 2007 for EWS access. Also, it appears as if you are attempting both delegate access and Exchange impersonation at the same time. The following should not be set (remove the delegate access portion of the code): 

    <t:Mailbox>
      <t:EmailAddress>*****@*****.*****</t:EmailAddress>
    </t:Mailbox>
    
    

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Monday, December 13, 2010 7:25 PM
    Moderator
  • Hello Jirka_,

    I'm not certain but I see two potential issues. Are the mailboxes you are trying to access on Exchange 2003? If they are, then this will not work. The Mailbox server and Client Access server need to both be Exchange 2007 for EWS access. Also, it appears as if you are attempting both delegate access and Exchange impersonation at the same time. The following should not be set (remove the delegate access portion of the code): 

    <
    t
    :
    Mailbox
    >
    
    < t : EmailAddress > *****@*****.*****</ t : EmailAddress >
    </ t : Mailbox >

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Hello,

    thanks for the reply. I removed a delegation but it did not help. Mailboxes are on both - Exchange 2007 and 2003. We imported them from 2003 to 2007 via PST files. However it still returns Internal server error.

    Wednesday, December 15, 2010 11:08 AM
  • Hello Jirka_,

    The issue is not with the code (at this point) but rather with your Exchange environment. I suspect the issue is with "Mailboxes are on both - Exchange 2007 and 2003". If the Client Access server is trying to service EWS requests for a mailbox that is on 2003, it will not work. Can you tell me whether the Client Access server indicates that it is servicing a 2003 mailbox? 

    With regards,

     


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    • Marked as answer by Jirka_ Friday, October 14, 2011 1:59 PM
    Wednesday, December 15, 2010 5:02 PM
    Moderator
  • Is there a possibility of moving mailbox from 2003 to 2007 without data being deleted on Exchange 2003? If we "move mailbox" from Exchange 2003 to 2007 it works. But we lose data on Exchange 2003.
    Thursday, December 16, 2010 2:06 PM
  • Hello Jirka_,

    As far as I know (I'm not very familiar with the Exchange administrator functions) , a mailbox can only exist on a single server. My question for you is why not just move mailboxes to 2007 since you have 2007 in your organization?

    With regards,


    Michael | Microsoft Exchange SDK

    The Exchange Development Forum Guide has useful information for using the Exchange Development Forum.

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Thursday, December 16, 2010 11:38 PM
    Moderator
  • I too have such a problem.

     

    It only appears to be for couple of users.

    I am using EWSEditor, and only doing impersonation.

    All 2007 sp2 ru 5.

    The issue is that ews for Blackberry wont work for calendar sync.  All Other users seem to work fine and I can log into/view the mailbox and its attributes via ews editor with no issues.

    For these users it throws internal server error

    Unexpected end of XML document.


    Thank you, Mr. V Messaging Engineer
    Monday, June 13, 2011 7:20 PM