public abstract class ServiceRequestBase<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
ServiceRequestBase(ExchangeService service)
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
protected HttpWebRequest |
buildEwsHttpPoolingWebRequest()
Builds a HttpWebRequest object from a pooling connection manager for current service request
with exception handling.
|
protected HttpWebRequest |
buildEwsHttpWebRequest()
Builds the HttpWebRequest object for current service request with exception handling.
|
protected HttpWebRequest |
getEwsHttpWebResponse(HttpWebRequest request)
Gets the IEwsHttpWebRequest object from the specifiedHttpWebRequest object with exception handling
|
protected abstract ExchangeVersion |
getMinimumRequiredServerVersion()
Gets the minimum server version required to process this request.
|
protected static InputStream |
getResponseStream(HttpWebRequest request)
Gets the response stream (may be wrapped with GZip/Deflate stream to decompress content).
|
protected abstract String |
getResponseXmlElementName()
Gets the name of the response XML element.
|
ExchangeService |
getService()
Gets the service.
|
abstract String |
getXmlElementName()
Gets the name of the XML element.
|
protected abstract T |
parseResponse(EwsServiceXmlReader reader)
Parses the response.
|
protected void |
processWebException(Exception webException,
HttpWebRequest req)
Processes the web exception.
|
protected void |
readPreamble(EwsServiceXmlReader ewsXmlReader)
Reads any preamble data not part of the core response.
|
protected T |
readResponse(EwsServiceXmlReader ewsXmlReader)
Reads the response.
|
protected T |
readResponse(HttpWebRequest response)
Reads the response.
|
protected SoapFaultDetails |
readSoapFault(EwsServiceXmlReader reader)
Reads the SOAP fault.
|
protected void |
throwIfNotSupportedByRequestedServerVersion()
Throw exception if request is not supported in requested server version.
|
protected void |
traceResponse(HttpWebRequest request,
ByteArrayOutputStream memoryStream)
Traces the response.
|
protected void |
validate()
Validate request.
|
protected HttpWebRequest |
validateAndEmitRequest()
Validates request parameters, and emits the request to the server.
|
protected void |
writeAttributesToXml(EwsServiceXmlWriter writer)
Writes XML attribute.
|
protected void |
writeBodyToXml(EwsServiceXmlWriter writer)
Writes XML body.
|
protected abstract void |
writeElementsToXml(EwsServiceXmlWriter writer)
Writes XML elements.
|
protected void |
writeToXml(EwsServiceXmlWriter writer)
Writes XML.
|
protected ServiceRequestBase(ExchangeService service) throws ServiceVersionException
service
- The service.ServiceVersionException
- the service version exceptionpublic abstract String getXmlElementName()
protected abstract String getResponseXmlElementName()
protected abstract ExchangeVersion getMinimumRequiredServerVersion()
protected abstract T parseResponse(EwsServiceXmlReader reader) throws Exception
reader
- The reader.Exception
- the exceptionprotected abstract void writeElementsToXml(EwsServiceXmlWriter writer) throws Exception
writer
- The writer.Exception
- the exceptionprotected void validate() throws Exception
ServiceLocalException
- the service local exceptionException
- the exceptionprotected void writeBodyToXml(EwsServiceXmlWriter writer) throws Exception
writer
- The writer.Exception
- the exceptionprotected void writeAttributesToXml(EwsServiceXmlWriter writer) throws ServiceXmlSerializationException
writer
- The writer.ServiceXmlSerializationException
- the service xml serialization exceptionpublic ExchangeService getService()
protected void throwIfNotSupportedByRequestedServerVersion() throws ServiceVersionException
ServiceVersionException
- the service version exceptionprotected void writeToXml(EwsServiceXmlWriter writer) throws Exception
writer
- The writer.Exception
- the exceptionprotected static InputStream getResponseStream(HttpWebRequest request) throws IOException, EWSHttpException
request
- HttpWebRequest object from which response stream can be read.IOException
- Signals that an I/O exception has occurred.EWSHttpException
- the EWS http exceptionprotected void traceResponse(HttpWebRequest request, ByteArrayOutputStream memoryStream) throws XMLStreamException, IOException, EWSHttpException
request
- the responsememoryStream
- the response content in a MemoryStreamXMLStreamException
- the XML stream exceptionIOException
- signals that an I/O exception has occurredEWSHttpException
- the EWS http exceptionprotected T readResponse(HttpWebRequest response) throws Exception
response
- HTTP web requestException
- on errorprotected T readResponse(EwsServiceXmlReader ewsXmlReader) throws Exception
ewsXmlReader
- The XML reader.Exception
- the exceptionprotected void readPreamble(EwsServiceXmlReader ewsXmlReader) throws Exception
ewsXmlReader
- The EwsServiceXmlReader.Exception
- on errorprotected void processWebException(Exception webException, HttpWebRequest req) throws Exception
webException
- the web exceptionreq
- HTTP Request object used to send the http requestException
- on errorprotected SoapFaultDetails readSoapFault(EwsServiceXmlReader reader)
reader
- The reader.protected HttpWebRequest validateAndEmitRequest() throws Exception
Exception
- on errorprotected HttpWebRequest buildEwsHttpWebRequest() throws Exception
Exception
- on errorprotected HttpWebRequest buildEwsHttpPoolingWebRequest() throws Exception
Used for subscriptions.
Exception
- on errorprotected HttpWebRequest getEwsHttpWebResponse(HttpWebRequest request) throws Exception
request
- The specified HttpWebRequestException
- on errorCopyright © 2012–2015 Microsoft. All rights reserved.