Class AutodiscoverService
- java.lang.Object
-
- microsoft.exchange.webservices.data.core.ExchangeServiceBase
-
- microsoft.exchange.webservices.data.autodiscover.AutodiscoverService
-
- All Implemented Interfaces:
Closeable,AutoCloseable,IAutodiscoverRedirectionUrl,IFunctionDelegate
public class AutodiscoverService extends ExchangeServiceBase implements IAutodiscoverRedirectionUrl, IFunctionDelegate
Represents a binding to the Exchange Autodiscover Service.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intAutodiscoverMaxRedirectionsThe Constant AutodiscoverMaxRedirections.-
Fields inherited from class microsoft.exchange.webservices.data.core.ExchangeServiceBase
externalHttpClient, externalHttpPoolingClient, httpClient, httpContext, httpPoolingClient
-
-
Constructor Summary
Constructors Constructor Description AutodiscoverService()Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(String domain)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(String domain, ExchangeVersion requestedServerVersion)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(URI url)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(URI url, String domain)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(URI url, String domain, ExchangeVersion requestedServerVersion)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(URI url, ExchangeVersion requestedServerVersion)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(ExchangeVersion requestedServerVersion)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(ExchangeServiceBase service)Initializes a new instance of the "AutodiscoverService" class.AutodiscoverService(ExchangeServiceBase service, ExchangeVersion requestedServerVersion)Initializes a new instance of the AutodiscoverService class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanautodiscoverRedirectionUrlValidationCallback(String redirectionUrl)Autodiscover redirection url validation callback.Objectfunc(List arg1, List arg2, ExchangeVersion arg3, URI arg4)Func.protected List<String>getAutodiscoverServiceHosts(String domainName, OutParam<Integer> outParam)Gets the list of autodiscover service hosts.protected List<URI>getAutodiscoverServiceUrls(String domainName, OutParam<Integer> scpHostCount)Gets the list of autodiscover service URLs.protected StringgetDnsServerAddress()Gets the dns server address.StringgetDomain()Gets the domain this service is bound to.GetDomainSettingsResponseCollectiongetDomainSettings(Iterable<String> domains, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames)Retrieves the specified settings for a set of domains.GetDomainSettingsResponsegetDomainSettings(String domain, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames)Retrieves the specified settings for a domain.protected GetDomainSettingsResponseCollectiongetDomainSettings(List<String> domains, List<DomainSettingName> settings, ExchangeVersion requestedVersion)Gets the domain settings using Autodiscover SOAP service.booleangetEnableScpLookup()Gets a value indicating whether the AutodiscoverService should perform SCP (ServiceConnectionPoint) record lookup when determining the Autodiscover service URL.protected <TSettings extends ConfigurationSettingsBase>
TSettingsgetLegacyUserSettings(Class<TSettings> cls, String emailAddress)Calls the legacy Autodiscover service to retrieve configuration settings.protected URIgetRedirectionUrlFromDnsSrvRecord(String domainName)Get an autodiscover SRV record in DNS and construct autodiscover URL.IAutodiscoverRedirectionUrlgetRedirectionUrlValidationCallback()Gets the redirection url validation callback.URIgetUrl()Gets the url this service is bound to.GetUserSettingsResponsegetUserSettings(String userSmtpAddress, UserSettingName... userSettingNames)Retrieves the specified settings for single SMTP address.protected GetUserSettingsResponseCollectiongetUserSettings(List<String> smtpAddresses, List<UserSettingName> settings)Gets the user settings using Autodiscover SOAP service.GetUserSettingsResponseCollectiongetUsersSettings(Iterable<String> userSmtpAddresses, UserSettingName... userSettingNames)Retrieves the specified settings for a set of users.protected GetUserSettingsResponseinternalGetLegacyUserSettings(String emailAddress, List<UserSettingName> requestedSettings)Gets user settings from Autodiscover legacy endpoint.protected GetUserSettingsResponseinternalGetSoapUserSettings(String smtpAddress, List<UserSettingName> requestedSettings)Calls the SOAP Autodiscover service for user settings for a single SMTP address.BooleanisExternal()HttpWebRequestprepareHttpWebRequestForUrl(URI url)Creates an HttpWebRequest instance and initializes it with the appropriate parameters, based on the configuration of this service object.voidprocessHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException)Processes an HTTP error response.protected voidsetDnsServerAddress(String value)Sets the dns server address.voidsetDomain(String value)Sets the domain this service is bound to.voidsetEnableScpLookup(boolean value)Sets the enable scp lookup.protected voidsetIsExternal(Boolean value)voidsetRedirectionUrlValidationCallback(IAutodiscoverRedirectionUrl value)Sets the redirection url validation callback.voidsetUrl(URI value)Sets the url this service is bound to.voidtraceResponse(HttpWebRequest request, ByteArrayOutputStream memoryStream)Traces the response.-
Methods inherited from class microsoft.exchange.webservices.data.core.ExchangeServiceBase
checkURIPath, close, convertDateTimeToUniversalDateTimeString, createConnectionSocketFactoryRegistry, doOnSerializeCustomSoapHeaders, getAcceptGzipEncoding, getCredentials, getHttpHeaders, getHttpResponseHeaders, getMaximumPoolingConnections, getOnSerializeCustomSoapHeaders, getRequestedServerVersion, getServerInfo, getSessionKey, getTimeout, getTraceFlags, getTraceListener, getUseDefaultCredentials, getUserAgent, getWebProxy, initializeHttpClient, initializeHttpPoolingClient, internalProcessHttpErrorResponse, isPreAuthenticate, isTraceEnabled, isTraceEnabledFor, isUseGlobalCookieStore, prepareCredentials, prepareHttpPoolingWebRequestForUrl, prepareHttpWebRequestForUrl, processHttpResponseHeaders, setAcceptGzipEncoding, setCredentials, setCustomUserAgent, setMaximumPoolingConnections, setOnSerializeCustomSoapHeaders, setPreAuthenticate, setServerInfo, setServiceRequestTracer, setTimeout, setTraceEnabled, setTraceFlags, setTraceListener, setUseDefaultCredentials, setUseGlobalCookieStore, setUserAgent, setWebProxy, traceHttpRequestHeaders, traceMessage, traceServiceRequestError, traceServiceRequestStart, traceServiceRequestSuccess, traceXml, validate
-
-
-
-
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- on validation error
-
AutodiscoverService
public AutodiscoverService(ExchangeVersion requestedServerVersion) throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.- Parameters:
requestedServerVersion- The requested server version- Throws:
ArgumentException- on validation error
-
AutodiscoverService
public AutodiscoverService(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- on validation error
-
AutodiscoverService
public AutodiscoverService(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 servicerequestedServerVersion- The requested server version- Throws:
ArgumentException- on validation error
-
AutodiscoverService
public AutodiscoverService(URI url) throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.- Parameters:
url- The URL of the service- Throws:
ArgumentException- on validation error
-
AutodiscoverService
public AutodiscoverService(URI url, ExchangeVersion requestedServerVersion) throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.- Parameters:
url- The URL of the servicerequestedServerVersion- The requested server version- Throws:
ArgumentException- on validation error
-
AutodiscoverService
public AutodiscoverService(URI url, String domain) throws ArgumentException
Initializes a new instance of the "AutodiscoverService" class.- Parameters:
url- The URL of the servicedomain- The domain that will be used to determine the URL of the service- Throws:
ArgumentException- on validation error
-
AutodiscoverService
public AutodiscoverService(URI url, 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- on validation error
-
AutodiscoverService
public AutodiscoverService(ExchangeServiceBase service, ExchangeVersion requestedServerVersion)
Initializes a new instance of the AutodiscoverService class.- Parameters:
service- The other service.requestedServerVersion- The requested server version.
-
AutodiscoverService
public AutodiscoverService(ExchangeServiceBase service)
Initializes a new instance of the "AutodiscoverService" class.- Parameters:
service- The service.
-
-
Method Detail
-
getLegacyUserSettings
protected <TSettings extends ConfigurationSettingsBase> TSettings getLegacyUserSettings(Class<TSettings> cls, String emailAddress) throws Exception
Calls the legacy Autodiscover service to retrieve configuration settings.- Type Parameters:
TSettings- the generic type- Parameters:
cls- the clsemailAddress- The email address to retrieve configuration settings for.- Returns:
- The requested configuration settings.
- Throws:
Exception- the exception
-
getRedirectionUrlFromDnsSrvRecord
protected URI getRedirectionUrlFromDnsSrvRecord(String domainName) throws 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:
Exception- the exception
-
internalGetLegacyUserSettings
protected GetUserSettingsResponse internalGetLegacyUserSettings(String emailAddress, List<UserSettingName> requestedSettings) throws Exception
Gets user settings from Autodiscover legacy endpoint.- Parameters:
emailAddress- The email address to use.requestedSettings- The requested settings.- Returns:
- GetUserSettingsResponse
- Throws:
Exception- on error
-
internalGetSoapUserSettings
protected GetUserSettingsResponse internalGetSoapUserSettings(String smtpAddress, List<UserSettingName> requestedSettings) throws 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:
Exception- on error
-
getUserSettings
protected GetUserSettingsResponseCollection getUserSettings(List<String> smtpAddresses, List<UserSettingName> settings) throws Exception
Gets the user settings using Autodiscover SOAP service.- Parameters:
smtpAddresses- The SMTP addresses of the users.settings- The settings.- Returns:
- GetUserSettingsResponseCollection Object.
- Throws:
Exception- the exception
-
getDomainSettings
protected GetDomainSettingsResponseCollection getDomainSettings(List<String> domains, List<DomainSettingName> settings, ExchangeVersion requestedVersion) throws 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:
Exception- the exception
-
getAutodiscoverServiceUrls
protected List<URI> getAutodiscoverServiceUrls(String domainName, OutParam<Integer> scpHostCount) throws 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:
URISyntaxException- the URI Syntax exception
-
getAutodiscoverServiceHosts
protected List<String> getAutodiscoverServiceHosts(String domainName, OutParam<Integer> outParam) throws URISyntaxException, ClassNotFoundException
Gets the list of autodiscover service hosts.- Parameters:
domainName- Domain name.outParam- the out param- Returns:
- List of hosts.
- Throws:
URISyntaxException- the uRI syntax exceptionClassNotFoundException- the class not found exception
-
traceResponse
public void traceResponse(HttpWebRequest request, ByteArrayOutputStream memoryStream) throws XMLStreamException, IOException, EWSHttpException
Traces the response.- Parameters:
request- the requestmemoryStream- the memory stream- Throws:
XMLStreamException- the XML stream exceptionIOException- signals that an I/O exception has occurred.EWSHttpException- the EWS http exception
-
prepareHttpWebRequestForUrl
public HttpWebRequest prepareHttpWebRequestForUrl(URI url) throws ServiceLocalException, 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 exceptionURISyntaxException- the uRI syntax exception
-
processHttpErrorResponse
public void processHttpErrorResponse(HttpWebRequest httpWebResponse, Exception webException) throws Exception
Processes an HTTP error response.- Specified by:
processHttpErrorResponsein classExchangeServiceBase- Parameters:
httpWebResponse- The HTTP web response.webException- web exception- Throws:
Exception- the exception
-
autodiscoverRedirectionUrlValidationCallback
public boolean autodiscoverRedirectionUrlValidationCallback(String redirectionUrl) throws AutodiscoverLocalException
Description copied from interface:IAutodiscoverRedirectionUrlAutodiscover redirection url validation callback.- Specified by:
autodiscoverRedirectionUrlValidationCallbackin interfaceIAutodiscoverRedirectionUrl- Parameters:
redirectionUrl- the redirection url- Returns:
- true, if successful
- Throws:
AutodiscoverLocalException- the autodiscover local exception
-
getUserSettings
public GetUserSettingsResponse getUserSettings(String userSmtpAddress, UserSettingName... userSettingNames) throws Exception
Retrieves the specified settings for single SMTP address.This method will run the entire Autodiscover "discovery" algorithm and will follow address and URL redirections.
- 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:
Exception- on error
-
getUsersSettings
public GetUserSettingsResponseCollection getUsersSettings(Iterable<String> userSmtpAddresses, UserSettingName... userSettingNames) throws Exception
Retrieves the specified settings for a set of users.- Parameters:
userSmtpAddresses- the user smtp addressesuserSettingNames- The user setting names.- Returns:
- A GetUserSettingsResponseCollection object containing the response for each individual user.
- Throws:
Exception- the exception
-
getDomainSettings
public GetDomainSettingsResponse getDomainSettings(String domain, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames) throws 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:
Exception- the exception
-
getDomainSettings
public GetDomainSettingsResponseCollection getDomainSettings(Iterable<String> domains, ExchangeVersion requestedVersion, DomainSettingName... domainSettingNames) throws Exception
Retrieves the specified settings for a set of domains.- Parameters:
domains- the domainsrequestedVersion- Requested version of the Exchange service.domainSettingNames- The domain setting names.- Returns:
- A GetDomainSettingsResponseCollection object containing the response for each individual domain.
- Throws:
Exception- the exception
-
getDomain
public 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(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- on validation error
-
setUrl
public void setUrl(URI value)
Sets the url this service is bound to.- Parameters:
value- the new url
-
isExternal
public Boolean isExternal()
-
setIsExternal
protected void setIsExternal(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 String getDnsServerAddress()
Gets the dns server address.- Returns:
- the dns server address
-
setDnsServerAddress
protected void setDnsServerAddress(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 Object func(List arg1, List arg2, ExchangeVersion arg3, URI arg4) throws ServiceLocalException, Exception
Description copied from interface:IFunctionDelegateFunc.- Specified by:
funcin interfaceIFunctionDelegate- Parameters:
arg1- the arg1arg2- the arg2arg3- the arg3arg4- the arg4- Returns:
- the t result
- Throws:
Exception- the exceptionServiceLocalException
-
-