microsoft.exchange.webservices.data
Class AutodiscoverService

java.lang.Object
  extended by microsoft.exchange.webservices.data.ExchangeServiceBase
      extended by microsoft.exchange.webservices.data.AutodiscoverService
All Implemented Interfaces:
IAutodiscoverRedirectionUrl

public final class AutodiscoverService
extends ExchangeServiceBase
implements IAutodiscoverRedirectionUrl

Represents a binding to the Exchange Autodiscover Service.


Field Summary
protected static int AutodiscoverMaxRedirections
          The Constant AutodiscoverMaxRedirections.
 
Constructor Summary
  AutodiscoverService()
          Initializes a new instance of the "AutodiscoverService" class.
protected AutodiscoverService(ExchangeServiceBase service)
          Initializes a new instance of the "AutodiscoverService" class.
protected AutodiscoverService(ExchangeServiceBase service, ExchangeVersion requestedServerVersion)
          Initializes a new instance of the AutodiscoverService class.
  AutodiscoverService(ExchangeVersion requestedServerVersion)
          Initializes a new instance of the "AutodiscoverService" class.
  AutodiscoverService(java.lang.String domain)
          Initializes a new instance of the "AutodiscoverService" class.
  AutodiscoverService(java.lang.String domain, ExchangeVersion requestedServerVersion)
          Initializes a new instance of the "AutodiscoverService" class.
  AutodiscoverService(java.net.URI url)
          Initializes a new instance of the "AutodiscoverService" class.
  AutodiscoverService(java.net.URI url, ExchangeVersion requestedServerVersion)
          Initializes a new instance of the "AutodiscoverService" class.
protected AutodiscoverService(java.net.URI url, java.lang.String domain)
          Initializes a new instance of the "AutodiscoverService" class.
protected AutodiscoverService(java.net.URI url, java.lang.String domain, ExchangeVersion requestedServerVersion)
          Initializes a new instance of the "AutodiscoverService" class.
 
Method Summary
 boolean autodiscoverRedirectionUrlValidationCallback(java.lang.String redirectionUrl)
          Autodiscover redirection url validation callback.
 java.lang.Object func(java.util.List arg1, java.util.List arg2, ExchangeVersion arg3, java.net.URI arg4)
          Func.
protected  java.util.List<java.lang.String> getAutodiscoverServiceHosts(java.lang.String domainName, OutParam<java.lang.Integer> outParam)
          Gets the list of autodiscover service hosts.
protected  java.util.List<java.net.URI> getAutodiscoverServiceUrls(java.lang.String domainName, OutParam<java.lang.Integer> scpHostCount)
          Gets the list of autodiscover service URLs.
protected  java.lang.String getDnsServerAddress()
          Gets the dns server address.
 java.lang.String getDomain()
          Gets the domain this service is bound to.
 GetDomainSettingsResponseCollection getDomainSettings(java.lang.Iterable<java.lang.String> domains, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames)
          Retrieves the specified settings for a set of domains.
protected  GetDomainSettingsResponseCollection getDomainSettings(java.util.List<java.lang.String> domains, java.util.List<DomainSettingName> settings, ExchangeVersion requestedVersion)
          Gets the domain settings using Autodiscover SOAP service.
 GetDomainSettingsResponse getDomainSettings(java.lang.String domain, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames)
          Retrieves the specified settings for a domain.
 boolean getEnableScpLookup()
          Gets a value indicating whether the AutodiscoverService should perform SCP (ServiceConnectionPoint) record lookup when determining the Autodiscover service URL.
protected
<TSettings extends microsoft.exchange.webservices.data.ConfigurationSettingsBase>
TSettings
getLegacyUserSettings(java.lang.Class<TSettings> cls, java.lang.String emailAddress)
          Calls the legacy Autodiscover service to retrieve configuration settings.
protected  java.net.URI getRedirectionUrlFromDnsSrvRecord(java.lang.String domainName)
          Get an autodiscover SRV record in DNS and construct autodiscover URL.
 IAutodiscoverRedirectionUrl getRedirectionUrlValidationCallback()
          Gets the redirection url validation callback.
 java.net.URI getUrl()
          Gets the url this service is bound to.
protected  GetUserSettingsResponseCollection getUserSettings(java.util.List<java.lang.String> smtpAddresses, java.util.List<UserSettingName> settings)
          Gets the user settings using Autodiscover SOAP service.
 GetUserSettingsResponse getUserSettings(java.lang.String userSmtpAddress, UserSettingName... userSettingNames)
          Retrieves the specified settings for single SMTP address.
 GetUserSettingsResponseCollection getUsersSettings(java.lang.Iterable<java.lang.String> userSmtpAddresses, UserSettingName... userSettingNames)
          Retrieves the specified settings for a set of users.
protected  GetUserSettingsResponse internalGetLegacyUserSettings(java.lang.String emailAddress, java.util.List<UserSettingName> requestedSettings)
          Gets user settings from Autodiscover legacy endpoint.
protected  GetUserSettingsResponse internalGetSoapUserSettings(java.lang.String smtpAddress, java.util.List<UserSettingName> requestedSettings)
          Calls the SOAP Autodiscover service for user settings for a single SMTP address.
 java.lang.Boolean isExternal()
           
protected  microsoft.exchange.webservices.data.HttpWebRequest prepareHttpWebRequestForUrl(java.net.URI url)
          Creates an HttpWebRequest instance and initializes it with the appropriate parameters, based on the configuration of this service object.
protected  void processHttpErrorResponse(microsoft.exchange.webservices.data.HttpWebRequest httpWebResponse, java.lang.Exception webException)
          Processes an HTTP error response.
protected  void setDnsServerAddress(java.lang.String value)
          Sets the dns server address.
 void setDomain(java.lang.String value)
          Sets the domain this service is bound to.
 void setEnableScpLookup(boolean value)
          Sets the enable scp lookup.
protected  void setIsExternal(java.lang.Boolean value)
           
 void setRedirectionUrlValidationCallback(IAutodiscoverRedirectionUrl value)
          Sets the redirection url validation callback.
 void setUrl(java.net.URI value)
          Sets the url this service is bound to.
protected  void traceResponse(microsoft.exchange.webservices.data.HttpWebRequest request, java.io.ByteArrayOutputStream memoryStream)
          Traces the response.
 
Methods inherited from class microsoft.exchange.webservices.data.ExchangeServiceBase
checkURIPath, convertDateTimeToUniversalDateTimeString, convertStartDateToUnspecifiedDateTime, convertUniversalDateTimeStringToDate, doOnSerializeCustomSoapHeaders, getAcceptGzipEncoding, getCookie, getCredentials, getHttpHeaders, getHttpResponseHeaders, getOnSerializeCustomSoapHeaders, getRequestedServerVersion, getServerInfo, getSessionKey, getSimpleHttpConnectionManager, getTimeout, getTraceFlags, getTraceListener, getUseDefaultCredentials, getUserAgent, getWebProxy, internalProcessHttpErrorResponse, isPreAuthenticate, isTraceEnabled, isTraceEnabledFor, prepareHttpWebRequestForUrl, processHttpResponseHeaders, setAcceptGzipEncoding, setCookie, setCredentials, setCustomUserAgent, setOnSerializeCustomSoapHeaders, setPreAuthenticate, setTimeout, setTraceEnabled, setTraceFlags, setTraceListener, setUseDefaultCredentials, setUserAgent, setWebProxy, traceHttpRequestHeaders, traceMessage, traceXml, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AutodiscoverMaxRedirections

protected static final int AutodiscoverMaxRedirections
The Constant AutodiscoverMaxRedirections.

See Also:
Constant Field Values
Constructor Detail

AutodiscoverService

public AutodiscoverService()
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Throws:
ArgumentException

AutodiscoverService

public AutodiscoverService(ExchangeVersion requestedServerVersion)
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
requestedServerVersion - The requested server version.
Throws:
ArgumentException

AutodiscoverService

public AutodiscoverService(java.lang.String domain)
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
domain - The domain that will be used to determine the URL of the service.
Throws:
ArgumentException

AutodiscoverService

public AutodiscoverService(java.lang.String domain,
                           ExchangeVersion requestedServerVersion)
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
domain - The domain that will be used to determine the URL of the service.
requestedServerVersion - The requested server version.
Throws:
ArgumentException

AutodiscoverService

public AutodiscoverService(java.net.URI url)
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
url - The URL of the service.
Throws:
ArgumentException

AutodiscoverService

public AutodiscoverService(java.net.URI url,
                           ExchangeVersion requestedServerVersion)
                    throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
url - The URL of the service.
requestedServerVersion - The requested server version.
Throws:
ArgumentException

AutodiscoverService

protected AutodiscoverService(java.net.URI url,
                              java.lang.String domain)
                       throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
url - The URL of the service.
domain - The domain that will be used to determine the URL of the service.
Throws:
ArgumentException

AutodiscoverService

protected AutodiscoverService(java.net.URI url,
                              java.lang.String domain,
                              ExchangeVersion requestedServerVersion)
                       throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
url - The URL of the service.
domain - The domain that will be used to determine the URL of the service.
requestedServerVersion - The requested server version.
Throws:
ArgumentException

AutodiscoverService

protected AutodiscoverService(ExchangeServiceBase service,
                              ExchangeVersion requestedServerVersion)
Initializes a new instance of the AutodiscoverService class.

Parameters:
service - The other service.
requestedServerVersion - The requested server version.

AutodiscoverService

protected AutodiscoverService(ExchangeServiceBase service)
Initializes a new instance of the "AutodiscoverService" class.

Parameters:
service - The service.
Method Detail

getLegacyUserSettings

protected <TSettings extends microsoft.exchange.webservices.data.ConfigurationSettingsBase> TSettings getLegacyUserSettings(java.lang.Class<TSettings> cls,
                                                                                                                            java.lang.String emailAddress)
                                                                                                         throws java.lang.Exception
Calls the legacy Autodiscover service to retrieve configuration settings.

Type Parameters:
TSettings - the generic type
Parameters:
cls - the cls
emailAddress - The email address to retrieve configuration settings for.
Returns:
The requested configuration settings.
Throws:
java.lang.Exception - the exception

getRedirectionUrlFromDnsSrvRecord

protected java.net.URI getRedirectionUrlFromDnsSrvRecord(java.lang.String domainName)
                                                  throws java.lang.Exception
Get an autodiscover SRV record in DNS and construct autodiscover URL.

Parameters:
domainName - Name of the domain.
Returns:
Autodiscover URL (may be null if lookup failed)
Throws:
java.lang.Exception - the exception

internalGetLegacyUserSettings

protected GetUserSettingsResponse internalGetLegacyUserSettings(java.lang.String emailAddress,
                                                                java.util.List<UserSettingName> requestedSettings)
                                                         throws java.lang.Exception
Gets user settings from Autodiscover legacy endpoint.

Parameters:
emailAddress - The email address to use.
requestedSettings - The requested settings.
Returns:
GetUserSettingsResponse
Throws:
java.lang.Exception

internalGetSoapUserSettings

protected GetUserSettingsResponse internalGetSoapUserSettings(java.lang.String smtpAddress,
                                                              java.util.List<UserSettingName> requestedSettings)
                                                       throws java.lang.Exception
Calls the SOAP Autodiscover service for user settings for a single SMTP address.

Parameters:
smtpAddress - SMTP address.
requestedSettings - The requested settings.
Returns:
GetUserSettingsResponse
Throws:
java.lang.Exception

getUserSettings

protected GetUserSettingsResponseCollection getUserSettings(java.util.List<java.lang.String> smtpAddresses,
                                                            java.util.List<UserSettingName> settings)
                                                     throws java.lang.Exception
Gets the user settings using Autodiscover SOAP service.

Parameters:
smtpAddresses - The SMTP addresses of the users.
settings - The settings.
Returns:
GetUserSettingsResponseCollection Object.
Throws:
java.lang.Exception - the exception

getDomainSettings

protected GetDomainSettingsResponseCollection getDomainSettings(java.util.List<java.lang.String> domains,
                                                                java.util.List<DomainSettingName> settings,
                                                                ExchangeVersion requestedVersion)
                                                         throws java.lang.Exception
Gets the domain settings using Autodiscover SOAP service.

Parameters:
domains - The domains.
settings - The settings.
requestedVersion - Requested version of the Exchange service.
Returns:
GetDomainSettingsResponse collection.
Throws:
java.lang.Exception - the exception

getAutodiscoverServiceUrls

protected java.util.List<java.net.URI> getAutodiscoverServiceUrls(java.lang.String domainName,
                                                                  OutParam<java.lang.Integer> scpHostCount)
                                                           throws java.net.URISyntaxException
Gets the list of autodiscover service URLs.

Parameters:
domainName - Domain name.
scpHostCount - Count of hosts found via SCP lookup.
Returns:
List of Autodiscover URLs.
Throws:
java.net.URISyntaxException - the URI Syntax exception

getAutodiscoverServiceHosts

protected java.util.List<java.lang.String> getAutodiscoverServiceHosts(java.lang.String domainName,
                                                                       OutParam<java.lang.Integer> outParam)
                                                                throws java.net.URISyntaxException,
                                                                       java.lang.ClassNotFoundException
Gets the list of autodiscover service hosts.

Parameters:
domainName - Domain name.
outParam - the out param
Returns:
List of hosts.
Throws:
java.net.URISyntaxException - the uRI syntax exception
java.lang.ClassNotFoundException - the class not found exception

traceResponse

protected void traceResponse(microsoft.exchange.webservices.data.HttpWebRequest request,
                             java.io.ByteArrayOutputStream memoryStream)
                      throws javax.xml.stream.XMLStreamException,
                             java.io.IOException,
                             EWSHttpException
Traces the response.

Parameters:
request - the request
memoryStream - the memory stream
Throws:
javax.xml.stream.XMLStreamException - the xML stream exception
java.io.IOException - Signals that an I/O exception has occurred.
EWSHttpException - the eWS http exception

prepareHttpWebRequestForUrl

protected microsoft.exchange.webservices.data.HttpWebRequest prepareHttpWebRequestForUrl(java.net.URI url)
                                                                                  throws ServiceLocalException,
                                                                                         java.net.URISyntaxException
Creates an HttpWebRequest instance and initializes it with the appropriate parameters, based on the configuration of this service object.

Parameters:
url - The URL that the HttpWebRequest should target.
Returns:
HttpWebRequest The HttpWebRequest.
Throws:
ServiceLocalException - the service local exception
java.net.URISyntaxException - the uRI syntax exception

processHttpErrorResponse

protected void processHttpErrorResponse(microsoft.exchange.webservices.data.HttpWebRequest httpWebResponse,
                                        java.lang.Exception webException)
                                 throws java.lang.Exception
Processes an HTTP error response.

Specified by:
processHttpErrorResponse in class ExchangeServiceBase
Parameters:
httpWebResponse - The HTTP web response.
Throws:
java.lang.Exception - the exception

autodiscoverRedirectionUrlValidationCallback

public boolean autodiscoverRedirectionUrlValidationCallback(java.lang.String redirectionUrl)
                                                     throws AutodiscoverLocalException
Description copied from interface: IAutodiscoverRedirectionUrl
Autodiscover redirection url validation callback.

Specified by:
autodiscoverRedirectionUrlValidationCallback in interface IAutodiscoverRedirectionUrl
Parameters:
redirectionUrl - the redirection url
Returns:
true, if successful
Throws:
AutodiscoverLocalException - the autodiscover local exception

getUserSettings

public GetUserSettingsResponse getUserSettings(java.lang.String userSmtpAddress,
                                               UserSettingName... userSettingNames)
                                        throws java.lang.Exception
Retrieves the specified settings for single SMTP address.

Parameters:
userSmtpAddress - The SMTP addresses of the user.
userSettingNames - The user setting names.
Returns:
A UserResponse object containing the requested settings for the specified user.
Throws:
java.lang.Exception - the exception This method handles will run the entire Autodiscover "discovery" algorithm and will follow address and URL redirections.

getUsersSettings

public GetUserSettingsResponseCollection getUsersSettings(java.lang.Iterable<java.lang.String> userSmtpAddresses,
                                                          UserSettingName... userSettingNames)
                                                   throws java.lang.Exception
Retrieves the specified settings for a set of users.

Parameters:
userSmtpAddresses - the user smtp addresses
userSettingNames - The user setting names.
Returns:
A GetUserSettingsResponseCollection object containing the responses for each individual user.
Throws:
java.lang.Exception - the exception

getDomainSettings

public GetDomainSettingsResponse getDomainSettings(java.lang.String domain,
                                                   ExchangeVersion requestedVersion,
                                                   DomainSettingName... domainSettingNames)
                                            throws java.lang.Exception
Retrieves the specified settings for a domain.

Parameters:
domain - The domain.
requestedVersion - Requested version of the Exchange service.
domainSettingNames - The domain setting names.
Returns:
A DomainResponse object containing the requested settings for the specified domain.
Throws:
java.lang.Exception - the exception

getDomainSettings

public GetDomainSettingsResponseCollection getDomainSettings(java.lang.Iterable<java.lang.String> domains,
                                                             ExchangeVersion requestedVersion,
                                                             DomainSettingName... domainSettingNames)
                                                      throws java.lang.Exception
Retrieves the specified settings for a set of domains.

Parameters:
domains - the domains
requestedVersion - Requested version of the Exchange service.
domainSettingNames - The domain setting names.
Returns:
A GetDomainSettingsResponseCollection object containing the responses for each individual domain.
Throws:
java.lang.Exception - the exception

getDomain

public java.lang.String getDomain()
Gets the domain this service is bound to. When this property is set, the domain name is used to automatically determine the Autodiscover service URL.

Returns:
the domain

setDomain

public void setDomain(java.lang.String value)
               throws ArgumentException
Sets the domain this service is bound to. When this property is set, the domain name is used to automatically determine the Autodiscover service URL.

Parameters:
value - the new domain
Throws:
ArgumentException

getUrl

public java.net.URI getUrl()
Gets the url this service is bound to.

Returns:
the url

setUrl

public void setUrl(java.net.URI value)
Sets the url this service is bound to.

Parameters:
value - the new url

isExternal

public java.lang.Boolean isExternal()

setIsExternal

protected void setIsExternal(java.lang.Boolean value)

getRedirectionUrlValidationCallback

public IAutodiscoverRedirectionUrl getRedirectionUrlValidationCallback()
Gets the redirection url validation callback.

Returns:
the redirection url validation callback

setRedirectionUrlValidationCallback

public void setRedirectionUrlValidationCallback(IAutodiscoverRedirectionUrl value)
Sets the redirection url validation callback.

Parameters:
value - the new redirection url validation callback

getDnsServerAddress

protected java.lang.String getDnsServerAddress()
Gets the dns server address.

Returns:
the dns server address

setDnsServerAddress

protected void setDnsServerAddress(java.lang.String value)
Sets the dns server address.

Parameters:
value - the new dns server address

getEnableScpLookup

public boolean getEnableScpLookup()
Gets a value indicating whether the AutodiscoverService should perform SCP (ServiceConnectionPoint) record lookup when determining the Autodiscover service URL.

Returns:
the enable scp lookup

setEnableScpLookup

public void setEnableScpLookup(boolean value)
Sets the enable scp lookup.

Parameters:
value - the new enable scp lookup

func

public java.lang.Object func(java.util.List arg1,
                             java.util.List arg2,
                             ExchangeVersion arg3,
                             java.net.URI arg4)
                      throws ServiceLocalException,
                             java.lang.Exception
Func.

Parameters:
arg1 - the arg1
arg2 - the arg2
arg3 - the arg3
Returns:
the t result
Throws:
ServiceLocalException - the service local exception
javax.xml.stream.XMLStreamException - the xML stream exception
java.io.IOException - Signals that an I/O exception has occurred.
java.lang.Exception - the exception