Please login or register to access secure site features.

Note: By continuing to use DevConnect Program Services you agree to our latest Registered Member Terms.

Sign in using DevConnect ID

Forgot password?

Trouble logging in?

Submit a ticket for Registration Support.

I have an SSO ID

?
sign in

Don't have a DevConnect or SSO ID ?

Create a DevConnect account or join the program.

register now
^
New DevConnect members must have forum permissions in order to post messages.
If the Reply and New Post buttons are not available to you, please request access using a General Support request ticket.
Forum Index » Avaya Client SDK - General » Android| How to implement autoconfigure use web address?   XML
 
Author Message
yudha



Joined: 02/04/2020 03:49:55
Messages: 7
Offline

Hi all,
How to implement autoconfigure with web address?, and how to set result from that!

i mean like this image
image

please sample code


best regard,

Yudha

This message was edited 2 times. Last update was at 02/04/2020 04:06:21

Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,

Thanks for your query!


From your query heading, seems that you are using Android platform.


Can you please have look at already answered query for similar ask for email ?

https://www.devconnectprogram.com/forums/posts/list/22003.page


You will find sample Android code on same post.


Thanks,
Avaya DevConnect Team


yudha



Joined: 02/04/2020 03:49:55
Messages: 7
Offline

Hi,

thank you for your answer,

After checking the file in onSuccess() and have succeeded what are the next steps,
how to use retrieveTextFromURL () and what code for return that?

Best Regards,

yudha
Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,

Please check sample code below.


public RetrieveConfigurationResult downloadConfiguration(@NonNull URL configUrl,
@NonNull ApplicationCredentialProvider applicationCredentialProvider) {
log.info("Auto-configuration requested from <{}>", configUrl);

final DownloadServiceConfiguration downloadServiceConfiguration = new DownloadServiceConfiguration();
downloadServiceConfiguration.setCredentialProvider(applicationCredentialProvider.getCredentialProvider(CHALLENGER_AUTO_CONFIG));

downloadService.retrieveTextFromUrl(downloadServiceConfiguration, configUrl, new DownloadCompletionHandler<String>() {
@Override
public void onSuccess(String downloaded) {
onDownloadSuccess(downloaded);
}

@Override
public void onError(DownloadServiceError error) {
onDownloadError(error);
}
});
try {
semaphore.acquire();
} catch (InterruptedException ignored) {
log.warn("Waiting for downloading auto-config from <{}> interrupted", configUrl);
}
return retrieveConfigurationResult;
}


Check for onSuccess().

private void onDownloadSuccess(@NonNull String downloaded) {
log.debug("Auto-config file retrieved successfully via URL");
try {
retrieveConfigurationResult = extractContent(downloaded);
} catch (AutoConfigException e) {
log.warn("Auto-config exception: {}", e.getMessage());
}
semaphore.release();
}

private void onDownloadError(@NonNull DownloadServiceError error) {
log.debug("Auto-config file retrieval via URL failed: {}", error);
retrieveConfigurationResult = new RetrieveConfigurationResult(getResultForError(error));
semaphore.release();
}




Thanks,
Avaya DevConnect Team
yudha



Joined: 02/04/2020 03:49:55
Messages: 7
Offline

Hi Pallavi_M,

Thanks for your answer,

But i have any questions for you

1. what's the contents of the RetrieveConfigurationResult class?
2. whats the contents of applicationCredentialProvider.getCredentialProvider(CHALLENGER_AUTO_CONFIG);?
3. whats mean the result of retrieveConfigurationResult?

please help me to explain it.

Best Regards,

Yudha
Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,


Please find answers to your questions:


1. what's the contents of the RetrieveConfigurationResult class?

Please check sample code:

/**
* Record type for storing the success or failure results of an auto-config
* operation.
*/
public class RetrieveConfigurationResult {

/** Reusable singleton object for the success case. */
public static final RetrieveConfigurationResult SUCCESS =
new RetrieveConfigurationResult();

@NonNull private final RetrieveConfigurationResultCode resultCode;

@Nullable private final URL url;

/** Private constructor for the success singleton. */
private RetrieveConfigurationResult() {
resultCode = OK;
url = null;
}

/**
* Constructor for a failure with no corresponding URL.
*
* @param resultCode The failure code.
*/
public RetrieveConfigurationResult(@NonNull RetrieveConfigurationResultCode resultCode) {
assert resultCode != OK;

this.resultCode = resultCode;
url = null;
}

/**
* Constructor for a failure with a corresponding URL.
*
* @param resultCode The failure code.
* @param url URL that caused the failure.
*/
public RetrieveConfigurationResult(@NonNull RetrieveConfigurationResultCode resultCode,
@NonNull URL url) {
assert resultCode != OK;

this.resultCode = resultCode;
this.url = url;
}

@NonNull
public RetrieveConfigurationResultCode getResultCode() {
return resultCode;
}

@Nullable
public URL getUrl() {
return url;
}

public boolean isSuccess() {
return resultCode == OK;
}

@SuppressWarnings("EqualsHashCodeCalledOnUrl")
@Override
public boolean equals(@Nullable Object o) {
if (this == o) {
return true;
}
if ((o == null) || (getClass() != o.getClass())) {
return false;
}

final RetrieveConfigurationResult other = (RetrieveConfigurationResult) o;
return (resultCode == other.resultCode) && Objects.equals(url, other.url);
}

@SuppressWarnings("EqualsHashCodeCalledOnUrl")
@Override
public int hashCode() {
int result = resultCode.hashCode();
result = (31 * result) + ((url != null) ? url.hashCode() : 0);
return result;
}

@NonNull
@Override
public String toString() {
if (isSuccess()) {
return "OK";
}

final StringBuilder buf = new StringBuilder(256);
buf.append(resultCode);
if (url != null) {
buf.append(" for <").append(url).append('>');
}
return buf.toString();
}
}


2. whats the contents of applicationCredentialProvider.getCredentialProvider(CHALLENGER_AUTO_CONFIG);?

You need to define this class as Application interface for handling authentication challenges. This is just a wrapper around the SDK's {@link CredentialProvider} interface to allow multiplexing. Application should register a single credential provider in the SDK
for all supported protocols, and requests to it are funneled through here to the application, which can delegate or dispatch based on the protocol type as it chooses.
getCredentialProvider will return CredentialProvider for above handling.


3. whats mean the result of retrieveConfigurationResult?

Please check answer for question 1


You can please check : Class SettingsFileParser for parsing.


Thanks,
Avaya DevConnect Team

This message was edited 1 time. Last update was at 06/04/2020 04:52:35

Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,


Please let me know if any further assistance is required for this query.


Thanks,
Avaya DevConnect Team
Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,


Please let me know if any further assistance is required for this query.


Thanks,
Avaya DevConnect Team
yudha



Joined: 02/04/2020 03:49:55
Messages: 7
Offline

Hi,

i get more problem.
what contents of RetrieveConfigurationResultCode?
image


Thanks,
Yudha
[Thumb - Screen Shot 2020-06-11 at 13.32.57.png]
 Filename Screen Shot 2020-06-11 at 13.32.57.png [Disk] Download
 Description No description given
 Filesize 13 Kbytes
 Downloaded:  336 time(s)

This message was edited 2 times. Last update was at 11/06/2020 01:42:06

Pallavi_M



Joined: 25/12/2017 03:04:15
Messages: 105
Offline

Hi,

RetrieveConfigurationResultCode will be enum for different errors.

public enum RetrieveConfigurationResultCode {

OK,
AUTH_FAILED,
CANCELLED,

and so on ------------------ depending on error code handling .

};

e.g. if you want to handle handleAuthenticationFailure, then you can use error code like AUTH_FAILED

@NonNull
private RetrieveConfigurationResult handleAuthenticationFailure()
{
==== your code =================
return new RetrieveConfigurationResult(AUTH_FAILED);
}


Thanks
Pallavi
 
 
Go to: