Menu

#166 EWS Parsing Issue?

v4.7.3
closed
nobody
None
5
2018-08-27
2012-06-28
Chad Harp
No

I receive and unexpected character error when trying to use EWS. It appears that EWS is sending back a decimal (byte count?) prior to each line of xml.

The first response it gets is:

740
<?xml version="1.0" encoding="utf-8"?><s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><h:ServerVersionInfo MajorVersion="14" MinorVersion="2" MajorBuildNumber="247" MinorBuildNumber="3" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/></s:Header><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><m:GetFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"><m:ResponseMessages><m:GetFolderResponseMessage ResponseClass="Success"><m:ResponseCode>NoError</m:ResponseCode><m:Folders><t:Folder><t:FolderId Id="AQAVAENFSGFycEBkc3RzeXN0ZW1zLmNvbQAuAAAD3g+GOY4TpUijVut7mC9kvgEA8m3I/es+Ck+D+S3p6nPR/wAAAbKIQgAAAA==" ChangeKey="AQAAABYAAADybcj96z4KT4P5Lenqc9H/AAAAveqs"/><t:DisplayName>Top of Information Store</t:DisplayName><t:ExtendedProperty><t:ExtendedFieldURI PropertyTag="0x3603" PropertyType="Integer"/><t:Value>0</t:Value></t:ExtendedProperty><t:ExtendedProperty><t:ExtendedFieldURI PropertyTag="0x6751" PropertyType="Integer"/><t:Value>1</t:Value></t:ExtendedProperty><t:ExtendedProperty><t:ExtendedFieldURI PropertyTag="0x670a" PropertyType="SystemTime"/><t:Value>2012-06-27T21:58:07Z</t:Value></t:ExtendedProperty><t:ExtendedProperty><t:ExtendedFieldURI PropertyTag="0x360a" PropertyType="Boolean"/><t:Value>true</t:Value></t:ExtendedProperty><t:ExtendedProperty><t:ExtendedFieldURI PropertyTag="0x3008" PropertyType="SystemTime"/><t:Value>2012-06-27T21:41:00Z</t:Value></t:ExtendedProperty></t:Folder></m:Folders></m:GetFolderResponseMessage></m:ResponseMessages></m:GetFolderResponse>
16
</s:Body></s:Envelope>
0

.
.
.

Which produces and exception:

2012-06-27 16:08:08,567 ERROR [ImapConnection-51683] davmail.exchange.ews.EWSMethod - com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1] Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
2012-06-27 16:08:08,929 ERROR [ImapConnection-51683] davmail.exchange.ews.EWSMethod - Error while parsing soap response: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2032)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1117)
at davmail.exchange.ews.EWSMethod.processResponseStream(EWSMethod.java:1066)
at davmail.exchange.ews.EWSMethod.processResponseBody(EWSMethod.java:1034)
at org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1749)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
at davmail.exchange.ews.EwsExchangeSession.executeMethod(EwsExchangeSession.java:2147)
at davmail.exchange.ews.EwsExchangeSession.internalGetFolder(EwsExchangeSession.java:991)
at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:227)
at davmail.exchange.ExchangeSession.<init>(ExchangeSession.java:200)
at davmail.exchange.ews.EwsExchangeSession.<init>(EwsExchangeSession.java:140)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:143)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:94)
at davmail.imap.ImapConnection.run(ImapConnection.java:114)
2012-06-27 16:08:08,931 ERROR [ImapConnection-51683] davmail.exchange.ews.EWSMethod - com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1] Unexpected character '7' (code 55) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
2012-06-27 16:08:08,931 ERROR [ImapConnection-51683] davmail.exchange.ExchangeSession - Folder not found
2012-06-27 16:08:08,932 ERROR [ImapConnection-51683] davmail.exchange.ExchangeSession - EWS end point not available
2012-06-27 16:08:08,933 ERROR [ImapConnection-51683] davmail - EWS end point not available
davmail.exception.DavMailAuthenticationException: EWS end point not available
at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:234)
at davmail.exchange.ExchangeSession.<init>(ExchangeSession.java:200)
at davmail.exchange.ews.EwsExchangeSession.<init>(EwsExchangeSession.java:140)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:143)
at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:94)
at davmail.imap.ImapConnection.run(ImapConnection.java:114)

Discussion

  • Mickael Guessant

    This is a chunked http response : size data size data 0 => this is supported by HttpClient and thus DavMail, maybe a missing header in Http response ? You can send a full WIRE DEBUG davmail.log to mguessan@free.fr

     
  • Mickael Guessant

    • status: open --> pending
     
  • John Lancaster

    John Lancaster - 2012-11-08

    I am also seeing this problem . I am using DavMail Gateway 4.1.0-2042 (in a server configuration) with exchange 2010 EWS.

    As Mickaël Guessant suggested I turned WIRE DEBUG on, but the failure does not occur when this level of logging is enabled.

    I suspect the problem is triggered by ldap lookups.

    Has the issue problem been resolved? Are there other tests I can conduct?

     
  • Mickael Guessant

    Just add:
    davmail.acceptEncodingGzip=false

    in davmail.properties to disable Gzip encoding

     
  • Mickael Guessant

    • status: pending --> closed
    • Group: --> v4.7.3
     

Log in to post a comment.