microsoft.exchange.webservices.data
Class ServiceResponse

java.lang.Object
  extended by microsoft.exchange.webservices.data.ServiceResponse
Direct Known Subclasses:
AttendeeAvailability, ConvertIdResponse, CreateAttachmentResponse, DelegateUserResponse, DeleteAttachmentResponse, FindItemResponse, GetFolderResponse, GetItemResponse, GetPasswordExpirationDateResponse, GetUserConfigurationResponse, GetUserOofSettingsResponse, MoveCopyFolderResponse, MoveCopyItemResponse, SyncResponse, UpdateItemResponse

public class ServiceResponse
extends java.lang.Object

Represents the standard response to an Exchange Web Services operation.


Constructor Summary
protected ServiceResponse()
          * Initializes a new instance.
protected ServiceResponse(microsoft.exchange.webservices.data.SoapFaultDetails soapFaultDetails)
          * Initializes a new instance.
 
Method Summary
protected  boolean getBatchProcessingStopped()
          Gets a value indicating whether a batch request stopped processing before the end.
 ServiceError getErrorCode()
          Gets the error code associated with this response.
 java.util.Map<java.lang.String,java.lang.String> getErrorDetails()
          Gets error details associated with the response.
 java.lang.String getErrorMessage()
          * Gets a detailed error message associated with the response.
 java.util.Collection<PropertyDefinitionBase> getErrorProperties()
          * Gets information about property errors associated with the response.
 ServiceResult getResult()
          Gets the result associated with this response.
protected  void internalThrowIfNecessary()
          * Internal method that throws a ServiceResponseException if this response has its Result property set to Error.
protected  void loaded()
          Called when the response has been loaded from XML.
protected  boolean loadExtraErrorDetailsFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader, java.lang.String xmlElementName)
          Loads extra error details from XML
protected  void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader, java.lang.String xmlElementName)
          * Loads response from XML.
protected  void mapErrorCodeToErrorMessage()
          Called after the response has been loaded from XML in order to map error codes to "better" error messages.
protected  void parseMessageXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
          * Parses the message XML.
protected  void readElementsFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
          * Reads response elements from XML.
protected  void setErrorMessage(java.lang.String errorMessage)
          Sets a detailed error message associated with the response.
protected  void throwIfNecessary()
          * Throws a ServiceResponseException if this response has its Result property set to Error.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceResponse

protected ServiceResponse()
* Initializes a new instance.


ServiceResponse

protected ServiceResponse(microsoft.exchange.webservices.data.SoapFaultDetails soapFaultDetails)
* Initializes a new instance.

Parameters:
soapFaultDetails - The SOAP fault details.
Method Detail

loadFromXml

protected void loadFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader,
                           java.lang.String xmlElementName)
                    throws java.lang.Exception
* Loads response from XML.

Parameters:
reader - the reader
xmlElementName - the xml element name
Throws:
java.lang.Exception - the exception

parseMessageXml

protected void parseMessageXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
                        throws java.lang.Exception
* Parses the message XML.

Parameters:
reader - The reader.
Throws:
java.lang.Exception - the exception

loaded

protected void loaded()
Called when the response has been loaded from XML.


mapErrorCodeToErrorMessage

protected void mapErrorCodeToErrorMessage()
Called after the response has been loaded from XML in order to map error codes to "better" error messages.


readElementsFromXml

protected void readElementsFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader)
                            throws ServiceXmlDeserializationException,
                                   javax.xml.stream.XMLStreamException,
                                   java.lang.InstantiationException,
                                   java.lang.IllegalAccessException,
                                   ServiceLocalException,
                                   java.lang.Exception
* Reads response elements from XML.

Parameters:
reader - The reader.
Throws:
ServiceXmlDeserializationException - the service xml deserialization exception
javax.xml.stream.XMLStreamException - the xML stream exception
java.lang.InstantiationException - the instantiation exception
java.lang.IllegalAccessException - the illegal access exception
ServiceLocalException - the service local exception
java.lang.Exception - the exception

loadExtraErrorDetailsFromXml

protected boolean loadExtraErrorDetailsFromXml(microsoft.exchange.webservices.data.EwsServiceXmlReader reader,
                                               java.lang.String xmlElementName)
                                        throws java.lang.Exception
Loads extra error details from XML

Parameters:
reader - The reader.
xmlElementName - The current element name of the extra error details.
Returns:
True if the expected extra details is loaded; False if the element name does not match the expected element.
Throws:
java.lang.Exception

throwIfNecessary

protected void throwIfNecessary()
                         throws ServiceResponseException
* Throws a ServiceResponseException if this response has its Result property set to Error.

Throws:
ServiceResponseException - the service response exception

internalThrowIfNecessary

protected void internalThrowIfNecessary()
                                 throws ServiceResponseException
* Internal method that throws a ServiceResponseException if this response has its Result property set to Error.

Throws:
ServiceResponseException - the service response exception

getBatchProcessingStopped

protected boolean getBatchProcessingStopped()
Gets a value indicating whether a batch request stopped processing before the end.

Returns:
A value indicating whether a batch request stopped processing before the end.

getResult

public ServiceResult getResult()
Gets the result associated with this response.

Returns:
The result associated with this response.

getErrorCode

public ServiceError getErrorCode()
Gets the error code associated with this response.

Returns:
The error code associated with this response.

getErrorMessage

public java.lang.String getErrorMessage()
* Gets a detailed error message associated with the response. If Result is set to Success, ErrorMessage returns null. ErrorMessage is localized according to the PreferredCulture property of the ExchangeService object that was used to call the method that generated the response.

Returns:
the error message

setErrorMessage

protected void setErrorMessage(java.lang.String errorMessage)
Sets a detailed error message associated with the response.

Parameters:
errorMessage - The error message associated with the response.

getErrorDetails

public java.util.Map<java.lang.String,java.lang.String> getErrorDetails()
Gets error details associated with the response. If Result is set to Success, ErrorDetailsDictionary returns null. Error details will only available for some error codes. For example, when error code is ErrorRecurrenceHasNoOccurrence, the ErrorDetailsDictionary will contain keys for EffectiveStartDate and EffectiveEndDate.

Returns:
The error details dictionary.

getErrorProperties

public java.util.Collection<PropertyDefinitionBase> getErrorProperties()
* Gets information about property errors associated with the response. If Result is set to Success, ErrorProperties returns null. ErrorProperties is only available for some error codes. For example, when the error code is ErrorInvalidPropertyForOperation, ErrorProperties will contain the definition of the property that was invalid for the request.

Returns:
the error properties