none
[E2010] [EWS Java API 1.1][JAVA] - Parse error comes when getting the tasks. RRS feed

  • Question

  • Hi,

    I am trying to get all the tasks from the Tasks folder.

        ExchangeService service = TestUtils.getExchangeService();
        FindItemsResults < Item > items = service.findItems( WellKnownFolderName.Tasks, new ItemView( 100 ) );
        for ( Item item : items )
        {
          System.out.println( item.getId().getUniqueId() );
        }

    But I am getting an exception.

    Exception in thread "main" microsoft.exchange.webservices.data.ServiceRequestException: The request failed. Could not read value from START_ELEMENT.Could not find CHARACTERS
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:52)
    	at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:140)
    	at microsoft.exchange.webservices.data.ExchangeService.findItems(ExchangeService.java:949)
    	at microsoft.exchange.webservices.data.ExchangeService.findItems(ExchangeService.java:1002)
    	at microsoft.exchange.webservices.data.ExchangeService.findItems(ExchangeService.java:1093)
    	at test.GetTasks.main(GetTasks.java:14)
    Caused by: 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:465)
    	at microsoft.exchange.webservices.data.StringList.tryReadElementFromXml(StringList.java:67)
    	at microsoft.exchange.webservices.data.ComplexProperty.loadFromXml(ComplexProperty.java:182)
    	at microsoft.exchange.webservices.data.ComplexProperty.loadFromXml(ComplexProperty.java:211)
    	at microsoft.exchange.webservices.data.ComplexPropertyDefinitionBase.internalLoadFromXml(ComplexPropertyDefinitionBase.java:95)
    	at microsoft.exchange.webservices.data.ComplexPropertyDefinitionBase.loadPropertyValueFromXml(ComplexPropertyDefinitionBase.java:118)
    	at microsoft.exchange.webservices.data.PropertyBag.loadFromXml(PropertyBag.java:487)
    	at microsoft.exchange.webservices.data.ServiceObject.loadFromXml(ServiceObject.java:268)
    	at microsoft.exchange.webservices.data.FindItemResponse.internalReadItemsFromXml(FindItemResponse.java:161)
    	at microsoft.exchange.webservices.data.FindItemResponse.readElementsFromXml(FindItemResponse.java:83)
    	at microsoft.exchange.webservices.data.ServiceResponse.loadFromXml(ServiceResponse.java:101)
    	at microsoft.exchange.webservices.data.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:52)
    	at microsoft.exchange.webservices.data.ServiceRequestBase.readResponse(ServiceRequestBase.java:445)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.readResponse(SimpleServiceRequestBase.java:102)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:39)
    	... 5 more
    
    I checked the EWSRequest send to the server and response received. I am providing those as well.

    EWSRequest
    
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/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">
    	<soap:Header>
    		<t:RequestServerVersion Version="Exchange2010_SP1" />
    	</soap:Header>
    	<soap:Body>
    		<m:FindItem Traversal="Shallow">
    			<m:ItemShape>
    				<t:BaseShape>AllProperties</t:BaseShape>
    			</m:ItemShape>
    			<m:IndexedPageItemView MaxEntriesReturned="100" Offset="0" BasePoint="Beginning" />
    			<m:ParentFolderIds>
    				<t:DistinguishedFolderId Id="tasks" />
    			</m:ParentFolderIds>
    		</m:FindItem>
    	</soap:Body>
    </soap:Envelope>
    
    EWS Response
    
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    	<s:Header><h:ServerVersionInfo MajorVersion="14" MinorVersion="1" MajorBuildNumber="218" MinorBuildNumber="14" Version="Exchange2010_SP1" 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:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    			<m:ResponseMessages>
    				<m:FindItemResponseMessage ResponseClass="Success">
    					<m:ResponseCode>NoError</m:ResponseCode>
    					<m:RootFolder IndexedPagingOffset="2" TotalItemsInView="2" IncludesLastItemInRange="true">
    						<t:Items>
    							<t:Task>
    								<t:ItemId Id="AAMkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNABGAAAAAABgw+wi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAADttiTWU2mSRpdkgpxkxONUAAAAAiIBAAA=" ChangeKey="EwAAABQAAABdoHTktE9jTppE8tnKO86oAABMDQ=="/>
    								<t:ParentFolderId Id="AAMkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNAAuAAAAAABgw+wi1GxZRJ8f7TY0MaoOAQDUNmqIPGloSaurMG41WjMaAAAAjRUEAAA=" ChangeKey="AQAAAA=="/>
    								<t:ItemClass>IPM.Task</t:ItemClass>
    								<t:Subject>hhhh</t:Subject>
    								<t:Sensitivity>Normal</t:Sensitivity>
    								<t:DateTimeReceived>2011-02-24T12:54:28Z</t:DateTimeReceived>
    								<t:Size>5804</t:Size>
    								<t:Importance>Normal</t:Importance>
    								<t:IsSubmitted>false</t:IsSubmitted>
    								<t:IsDraft>false</t:IsDraft>
    								<t:IsFromMe>false</t:IsFromMe>
    								<t:IsResend>false</t:IsResend>
    								<t:IsUnmodified>false</t:IsUnmodified>
    								<t:DateTimeSent>2011-02-24T12:54:28Z</t:DateTimeSent>
    								<t:DateTimeCreated>2011-02-24T12:54:24Z</t:DateTimeCreated>
    								<t:ReminderIsSet>false</t:ReminderIsSet>
    								<t:ReminderMinutesBeforeStart>0</t:ReminderMinutesBeforeStart>
    								<t:DisplayCc/>
    								<t:DisplayTo/>
    								<t:HasAttachments>false</t:HasAttachments>
    								<t:Culture>en-US</t:Culture>
    								<t:EffectiveRights>
    									<t:CreateAssociated>false</t:CreateAssociated>
    									<t:CreateContents>false</t:CreateContents>
    									<t:CreateHierarchy>false</t:CreateHierarchy>
    									<t:Delete>true</t:Delete>
    									<t:Modify>true</t:Modify>
    									<t:Read>true</t:Read>
    									<t:ViewPrivateItems>true</t:ViewPrivateItems>
    								</t:EffectiveRights>
    								<t:LastModifiedName>sample</t:LastModifiedName>
    								<t:LastModifiedTime>2011-02-24T12:54:24Z</t:LastModifiedTime>
    								<t:IsAssociated>false</t:IsAssociated>
    								<t:WebClientReadFormQueryString>
    									?ae=Item&amp;t=IPM.Task&amp;id=RgAAAABgw%2bwi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAADttiTWU2mSRpdkgpxkxONUAAAAAiIBAAAT&amp;exvsurl=1
    								</t:WebClientReadFormQueryString>
    								<t:WebClientEditFormQueryString>
    									?ae=Item&amp;a=Open&amp;s=Draft&amp;t=IPM.Task&amp;id=RgAAAABgw%2bwi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAADttiTWU2mSRpdkgpxkxONUAAAAAiIBAAAT&amp;exvsurl=1
    								</t:WebClientEditFormQueryString>
    								<t:ConversationId Id="AAQkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNAAQAGFcq7yHQl7UFgn/jnrxEPQ="/>
    								<t:ActualWork>0</t:ActualWork>
    								<t:ChangeCount>2</t:ChangeCount>
    								<t:DelegationState>NoMatch</t:DelegationState>
    								<t:Delegator/>
    								<t:IsAssignmentEditable>0</t:IsAssignmentEditable>
    								<t:IsComplete>false</t:IsComplete>
    								<t:IsRecurring>false</t:IsRecurring>
    								<t:IsTeamTask>false</t:IsTeamTask>
    								<t:Owner>sample</t:Owner>
    								<t:PercentComplete>0</t:PercentComplete>
    								<t:Status>NotStarted</t:Status>
    								<t:TotalWork>0</t:TotalWork>
    							</t:Task>
    							<t:Task>
    								<t:ItemId Id="AAMkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNABGAAAAAABgw+wi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAACOm9QySEvZT7zAEfIxnMxuAAAAAG11AAA=" ChangeKey="EwAAABYAAACOm9QySEvZT7zAEfIxnMxuAAAAAG91"/>
    								<t:ParentFolderId Id="AAMkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNAAuAAAAAABgw+wi1GxZRJ8f7TY0MaoOAQDUNmqIPGloSaurMG41WjMaAAAAjRUEAAA=" ChangeKey="AQAAAA=="/>
    								<t:ItemClass>IPM.Task</t:ItemClass>
    								<t:Subject/>
    								<t:Sensitivity>Normal</t:Sensitivity>
    								<t:DateTimeReceived>2011-02-23T18:16:40Z</t:DateTimeReceived>
    								<t:Size>157</t:Size>
    								<t:Importance>Normal</t:Importance>
    								<t:IsSubmitted>false</t:IsSubmitted>
    								<t:IsDraft>false</t:IsDraft>
    								<t:IsFromMe>false</t:IsFromMe>
    								<t:IsResend>false</t:IsResend>
    								<t:IsUnmodified>false</t:IsUnmodified>
    								<t:DateTimeSent>2011-02-23T18:16:40Z</t:DateTimeSent>
    								<t:DateTimeCreated>2011-02-23T18:16:40Z</t:DateTimeCreated>
    								<t:DisplayCc/>
    								<t:DisplayTo/>
    								<t:HasAttachments>false</t:HasAttachments>
    								<t:Culture>en-US</t:Culture>
    								<t:EffectiveRights>
    									<t:CreateAssociated>false</t:CreateAssociated>
    									<t:CreateContents>false</t:CreateContents>
    									<t:CreateHierarchy>false</t:CreateHierarchy>
    									<t:Delete>true</t:Delete>
    									<t:Modify>true</t:Modify>
    									<t:Read>true</t:Read>
    									<t:ViewPrivateItems>true</t:ViewPrivateItems>
    								</t:EffectiveRights>
    								<t:LastModifiedName>sample</t:LastModifiedName>
    								<t:LastModifiedTime>2011-02-23T18:16:40Z</t:LastModifiedTime>
    								<t:IsAssociated>false</t:IsAssociated>
    								<t:WebClientReadFormQueryString>
    									?ae=Item&amp;t=IPM.Task&amp;id=RgAAAABgw%2bwi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAACOm9QySEvZT7zAEfIxnMxuAAAAAG11AAAT&amp;exvsurl=1
    								</t:WebClientReadFormQueryString>
    								<t:WebClientEditFormQueryString>
    									?ae=Item&amp;a=Open&amp;s=Draft&amp;t=IPM.Task&amp;id=RgAAAABgw%2bwi1GxZRJ8f7TY0MaoOBwDUNmqIPGloSaurMG41WjMaAAAAjRUEAACOm9QySEvZT7zAEfIxnMxuAAAAAG11AAAT&amp;exvsurl=1
    								</t:WebClientEditFormQueryString>
    								<t:ConversationId Id="AAQkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNAAQANQdjNmPALIE6YAJmOz4Qn4="/>
    								<t:ActualWork>100</t:ActualWork>
    								<t:ChangeCount>1</t:ChangeCount>
    								<t:Companies><t:String/></t:Companies>
    								<t:IsComplete>false</t:IsComplete>
    								<t:IsRecurring>false</t:IsRecurring>
    								<t:PercentComplete>0</t:PercentComplete>
    								<t:Status>NotStarted</t:Status>
    							</t:Task>
    						</t:Items>
    					</m:RootFolder>
    				</m:FindItemResponseMessage>
    			</m:ResponseMessages>
    		</m:FindItemResponse>
    	</s:Body>
    </s:Envelope>

    In the response, I could see that the task details are coming back to the client. But while parsing this EWS JAVA API is causing some error.

    Please some one check and let me know what is the problem. I will provide more information, if I could find any.

    Thanks,

    Paul

     

     

     

    Wednesday, March 2, 2011 8:36 AM

All replies

  • Hi Paul, Thanks for reporting this issue.  We tried this and we were unable to repro the issue . To continue the investigation, we will contact you in private to get more details
    Friday, May 13, 2011 8:01 AM
  • Hi,

    I´ve exactly the same problem. Here is the Response I get from EWS:

     

    <Trace Tag="EwsResponse" Tid="21" Time="2011-06-20 07:27:06Z">
    	<?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="1" MajorBuildNumber="375" MinorBuildNumber="1" Version="Exchange2007_SP1" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
    		</soap:Header>
    		<soap:Body>
    			<m:FindItemResponse xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
    				<m:ResponseMessages>
    					<m:FindItemResponseMessage ResponseClass="Success">
    						<m:ResponseCode>NoError</m:ResponseCode>
    						<m:RootFolder TotalItemsInView="7" IncludesLastItemInRange="true">
    							<t:Items>
    								<t:CalendarItem>
    									<t:ItemId Id="AAMkADI2OTc4ODA5LWFjNzQtNGQyMi1hYTRmLWQxYTY2NzMwZDk2OABGAAAAAACYRVy6i62AQLjIi+/u5e94BwDcmq/6gB+QSJ7qx+b3RY8cAAAAZQnqAAC8yaVoNW/1TLrghUhkOlcTABMKgORuAAA=" ChangeKey="DwAAABYAAAC8yaVoNW/1TLrghUhkOlcTABMKvquY" />
    									<t:ParentFolderId Id="AAMkADI2OTc4ODA5LWFjNzQtNGQyMi1hYTRmLWQxYTY2NzMwZDk2OAAuAAAAAACYRVy6i62AQLjIi+/u5e94AQDcmq/6gB+QSJ7qx+b3RY8cAAAAZQnqAAA=" ChangeKey="AQAAAA==" />
    									<t:ItemClass>IPM.Appointment</t:ItemClass>
    									<t:Subject> </t:Subject>
    									<t:Sensitivity>Normal</t:Sensitivity>
    									<t:DateTimeReceived>2011-06-20T07:22:25Z</t:DateTimeReceived>
    									<t:Size>856</t:Size>
    									<t:Importance>Normal</t:Importance>
    									<t:IsSubmitted>false</t:IsSubmitted>
    									<t:IsDraft>false</t:IsDraft>
    									<t:IsFromMe>false</t:IsFromMe>
    									<t:IsResend>false</t:IsResend>
    									<t:IsUnmodified>false</t:IsUnmodified>
    									<t:DateTimeSent>2011-06-20T07:22:25Z</t:DateTimeSent>
    									<t:DateTimeCreated>2011-06-20T07:22:25Z</t:DateTimeCreated>
    									<t:ReminderDueBy>2011-06-19T22:00:00Z</t:ReminderDueBy>
    									<t:ReminderIsSet>true</t:ReminderIsSet>
    									<t:ReminderMinutesBeforeStart>15</t:ReminderMinutesBeforeStart>
    									<t:DisplayCc />
    									<t:DisplayTo />
    									<t:HasAttachments>false</t:HasAttachments>
    									<t:Culture>de-DE</t:Culture>
    									<t:EffectiveRights>
    										<t:CreateAssociated>false</t:CreateAssociated>
    										<t:CreateContents>false</t:CreateContents>
    										<t:CreateHierarchy>false</t:CreateHierarchy>
    										<t:Delete>true</t:Delete>
    										<t:Modify>true</t:Modify>
    										<t:Read>true</t:Read>
    									</t:EffectiveRights>
    									<t:LastModifiedName>RS-Seminarraum 1</t:LastModifiedName>
    									<t:LastModifiedTime>2011-06-20T07:22:25Z</t:LastModifiedTime>
    									<t:UID>040000008200E00074C5B7101A82E008000000009479A9CD1A2FCC01000000000000000010000000921FD95D5E1FC341A9EE847B4304D18C</t:UID>
    									<t:DateTimeStamp>2011-06-20T07:22:25Z</t:DateTimeStamp>
    									<t:Start>2011-06-19T22:00:00Z</t:Start>
    									<t:End>2011-06-20T22:00:00Z</t:End>
    									<t:IsAllDayEvent>true</t:IsAllDayEvent>
    									<t:LegacyFreeBusyStatus>Busy</t:LegacyFreeBusyStatus>
    									<t:Location />
    									<t:IsMeeting>false</t:IsMeeting>
    									<t:IsRecurring>false</t:IsRecurring>
    									<t:MeetingRequestWasSent>false</t:MeetingRequestWasSent>
    									<t:IsResponseRequested>true</t:IsResponseRequested>
    									<t:CalendarItemType>Single</t:CalendarItemType>
    									<t:MyResponseType>Organizer</t:MyResponseType>
    									<t:Organizer>
    										<t:Mailbox>
    											<t:Name>RS-Seminarraum 1 Aachen</t:Name>
    										</t:Mailbox>
    									</t:Organizer>
    									<t:Duration>P1D</t:Duration>
    									<t:TimeZone>W. Europe Standard Time</t:TimeZone>
    									<t:AppointmentSequenceNumber>0</t:AppointmentSequenceNumber>
    									<t:AppointmentState>0</t:AppointmentState>
    								</t:CalendarItem>
    							</t:Items>
    						</m:RootFolder>
    					</m:FindItemResponseMessage>
    				</m:ResponseMessages>
    			</m:FindItemResponse>
    		</soap:Body>
    	</soap:Envelope>
    </Trace>
    
    


    I´ve figured out if for example the subject has only spaces, I got this error and so I don´t get any appointments of the specified mailbox. If I create an appointment with no text in it (also no spaces) it works. So i guess the problem are the spaces....

    thanks

    bodo

    Monday, June 20, 2011 7:49 AM
  • Hi,

    I have shared you my response that gives the error.

     

    http://dl.dropbox.com/u/27532041/output.txt

    As bodo said above, it seems it has to do something with the Space. If I create a task with Companies field as space, when I try to find all the items from the tasks folder I get this exception.

     

    Please use the following test case to reproduce the issue.

    public class GetAllTasks
    {
      public static void main( String [] args ) throws Throwable
      {
        ExchangeService service = TestUtil.getService();
    
        // Clear all items in the tasks folder.
        clearAllItems( service );
    
        // Create a task with Companies name as " ".
        Task task = new Task( service );
        StringList value = new StringList();
        value.add( " " );
        task.setCompanies( value );
    
        Collection < Item > itemsToCreate = new ArrayList < Item >();
        itemsToCreate.add( task );
        service.createItems( itemsToCreate, new FolderId( WellKnownFolderName.Tasks ), MessageDisposition.SaveOnly,
            SendInvitationsMode.SendToNone );
    
        Folder tasksFolder = Folder.bind( service, WellKnownFolderName.Tasks );
        // Try to get all the tasks. The exception occurs at this line.
        FindItemsResults < Item > items = tasksFolder.findItems( new ItemView( 1000 ) );
    
        System.out.println( items.getTotalCount() );
      }
    
      private static void clearAllItems( ExchangeService service ) throws Exception, ServiceLocalException
      {
        // service.setTraceEnabled( true );
        Folder tasksFolder = Folder.bind( service, WellKnownFolderName.Tasks );
        FindItemsResults < Item > items = tasksFolder.findItems( new ItemView( 1000 ) );
        List < ItemId > itemIds = new ArrayList < ItemId >();
        for ( Item item : items )
        {
          System.out.println( item.getId() );
          itemIds.add( item.getId() );
        }
        if ( itemIds.size() > 0 )
        {
          service.deleteItems( itemIds, DeleteMode.HardDelete, SendCancellationsMode.SendToNone,
              AffectedTaskOccurrence.AllOccurrences );
          System.out.println( "Deleted all tasks" );
        }
      }
    }


    Please help us resolve the issue.

     

    Thanks,

    Paul

     

    Friday, August 19, 2011 12:56 PM
  • Not Only value.add(" ");

     

    The following also fails.

     

            StringList value = new StringList();
            value.add( "" ); //Empty String
            task.setCompanies( value );

     

    Regards,

    Paul

    Friday, August 19, 2011 12:59 PM