none
EWS/Java - Identifier converted but appointment does not bind RRS feed

  • Question

  • I am converting a project from CDO to EWS (using Java API 1.2). The old version kept track of the appointment IDs generated by Exchange when appointments were created. The information is needed to update or delete appointments. CDO identifiers don't match any ids offered by EWS. After a lot of searching I figured out that the CDO ID has 80 bytes of junk, followed by what looks like a valid EWS Hex ID. I convert the Hex ID to EWS ID and EWS is happy. I tested it both ways (adding the junk back to the HexID makes CDO happy too) and all worked fine. When I finally got to process the real legacy data I encounter many CDO IDs that convert fine to EWS ID but the appointment does not bind. See exception below:

    microsoft.exchange.webservices.data.EWSHttpException: Connection not established
            at microsoft.exchange.webservices.data.HttpClientWebRequest.throwIfConnIsNull(Unknown Source)
            at microsoft.exchange.webservices.data.HttpClientWebRequest.getResponseHeaders(Unknown Source)
            at microsoft.exchange.webservices.data.ExchangeServiceBase.processHttpResponseHeaders(Unknown Source)
            at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(Unknown Source)
            at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(Unknown Source)
            at microsoft.exchange.webservices.data.ExchangeService.internalBindToItems(Unknown Source)
            at microsoft.exchange.webservices.data.ExchangeService.bindToItem(Unknown Source)
            at microsoft.exchange.webservices.data.ExchangeService.bindToItem(Unknown Source)
            at microsoft.exchange.webservices.data.Appointment.bind(Unknown Source)
            at microsoft.exchange.webservices.data.Appointment.bind(Unknown Source)
            at testws.EWSTester.test(EWSTester.java:124)
            at testws.EWSTester.main(EWSTester.java:30)

    What does it mean? The appointment does exist but I can't get to it (why?)? The key conversion is simply a numeric calculation and does not guarantee that either the input or the output represent valid items? Is there any reliable way to bridge the CDO and EWS worlds?

    Dan

    Wednesday, November 13, 2013 6:17 PM

Answers

  • Laurent gave me the solution in this similar thread:

    [E2010] [EWSJA] [JAVA] [Windows Server 2003] email having null character in subject

    (sorry, I'm not allowed to post links until my account is verified and I'm not sure how to do that).

    A fix is needed in the error handling in EwsXmlReader.readValue() in the Java API library. Modify:

    errMsg = errMsg + "Could not find "
                    + XMLNodeType.getString(XMLNodeType.CHARACTERS);
                    throw new ServiceXmlDeserializationException(errMsg);

    to


    //we reached the end element, so xml is well formated. Return empty string
                    if (this.presentEvent.isEndElement()) {
                        return "";
                    } else {
                        errMsg = errMsg + "Could not find "
                                + XMLNodeType.getString(XMLNodeType.CHARACTERS);
                        throw new ServiceXmlDeserializationException(errMsg);
                    }

    Dan

     

    • Marked as answer by Dan Jerghiuta Tuesday, November 19, 2013 4:52 PM
    Tuesday, November 19, 2013 4:52 PM

All replies

  • By CDO Id do you PR_EntryID is so you should be using EWS's ConvertID operations to convert these see http://msdn.microsoft.com/en-us/library/bb799665(v=exchg.150).aspx . You should convert between the HexEntryID to EWSid which will ensure you have a valid Id.

    Cheers
    Glen

    Thursday, November 14, 2013 4:15 AM
  • That's what i am doing. I am getting Ews IDs back but for many of them i get the error above when i bind to the appointment.
    Thursday, November 14, 2013 2:20 PM
  • BTW, do you know what the error "Connection not established" means in the context of binding to an appointment? The application user has full access to the mailbox (it was needed in the CDO implementation) so I don't think it's a permission issue.
    Thursday, November 14, 2013 2:54 PM
  • It looks like "connection no established" is being throw by the client which could mean it's just a Bug in Java API.

    As a test I would suggest you download the EWSEditor http://ewseditor.codeplex.com/ . And try one of the Id's your have a problem with. Its has the ability to both Convert and ID and Open an Item using the EWSId (in the other menu). (you should at least get a different error which maybe more meaningful)

    Cheers
    Glen

    Friday, November 15, 2013 1:42 AM
  • Thank you, Glen! The tool is great! Unfortunately it agrees with you that it may be a library issue. It can open the appointment with my converted EWSId.
    Friday, November 15, 2013 2:50 PM
  • Glen,

    "Connection not established" is a bogus error. It is thrown because the library is trying to do some further processing in an exception catch block, where the httpclient has already been closed. The original exception is

    microsoft.exchange.webservices.data.ServiceXmlDeserializationException

    : Could not read value from START_ELEMENT.Could not find CHARACTERS

    at microsoft.exchange.webservices.data.EwsXmlReader.readValue(

    EwsXmlReader.java:467)

    at microsoft.exchange.webservices.data.EwsXmlReader.readElementValue(

    EwsXmlReader.java:352)

    at microsoft.exchange.webservices.data.TypedPropertyDefinition.loadPropertyValueFromXml(

    TypedPropertyDefinition.java:127)

    at microsoft.exchange.webservices.data.PropertyBag.loadFromXml(

    PropertyBag.java:487)

    at microsoft.exchange.webservices.data.ServiceObject.loadFromXml(

    ServiceObject.java:270)

    at microsoft.exchange.webservices.data.EwsServiceXmlReader.readServiceObjectsCollectionFromXml(

    EwsServiceXmlReader.java:212)

    at microsoft.exchange.webservices.data.GetItemResponse.readElementsFromXml(

    GetItemResponse.java:56)

    at microsoft.exchange.webservices.data.ServiceResponse.loadFromXml(

    ServiceResponse.java:102)

    at microsoft.exchange.webservices.data.MultiResponseServiceRequest.parseResponse(

    MultiResponseServiceRequest.java:54)

    at microsoft.exchange.webservices.data.ServiceRequestBase.readResponse(

    ServiceRequestBase.java:532)

    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.readResponse(

    SimpleServiceRequestBase.java:177)

    at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(

    SimpleServiceRequestBase.java:49)

    at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(

    MultiResponseServiceRequest.java:144)

    at microsoft.exchange.webservices.data.ExchangeService.internalBindToItems(

    ExchangeService.java:1364)

    at microsoft.exchange.webservices.data.ExchangeService.bindToItem(

    ExchangeService.java:1407)

    at microsoft.exchange.webservices.data.ExchangeService.bindToItem(

    ExchangeService.java:1430)

    at microsoft.exchange.webservices.data.Appointment.bind(

    Appointment.java:70)

    at microsoft.exchange.webservices.data.Appointment.bind(

    Appointment.java:88)

    at testws.EWSTester.test(

    EWSTester.java:125)

    at testws.EWSTester.main(

    EWSTester.java:30)

    Do you know what could be the cause?

    Thank you!

    Dan

    Tuesday, November 19, 2013 3:27 PM
  • Laurent gave me the solution in this similar thread:

    [E2010] [EWSJA] [JAVA] [Windows Server 2003] email having null character in subject

    (sorry, I'm not allowed to post links until my account is verified and I'm not sure how to do that).

    A fix is needed in the error handling in EwsXmlReader.readValue() in the Java API library. Modify:

    errMsg = errMsg + "Could not find "
                    + XMLNodeType.getString(XMLNodeType.CHARACTERS);
                    throw new ServiceXmlDeserializationException(errMsg);

    to


    //we reached the end element, so xml is well formated. Return empty string
                    if (this.presentEvent.isEndElement()) {
                        return "";
                    } else {
                        errMsg = errMsg + "Could not find "
                                + XMLNodeType.getString(XMLNodeType.CHARACTERS);
                        throw new ServiceXmlDeserializationException(errMsg);
                    }

    Dan

     

    • Marked as answer by Dan Jerghiuta Tuesday, November 19, 2013 4:52 PM
    Tuesday, November 19, 2013 4:52 PM