Exemple de code Java : soumissions d’applications, d’extensions et de versions d’évaluation
Cet article fournit des exemples de code Java qui montrent comment utiliser l’API de soumission du Microsoft Store pour les tâches suivantes :
- Obtenir un jeton d’accès Azure AD
- Créer une extension
- Crée une version d’évaluation du package
- Créer une soumission d’applications
- Créer une soumission d’extension
- Créer une soumission de version d’évaluation du package
Vous pouvez passer en revue chaque exemple pour en savoir plus sur la tâche qu’elle illustre, ou vous pouvez générer tous les exemples de code de cet article dans une application console. Pour obtenir la description complète du code, consultez la section liste de codes à la fin de cet article.
Prérequis
Ces exemples utilisent les bibliothèques suivantes :
- Journalisation Apache Commons 1.2 (commons-logging-1.2.jar).
- Apache HttpComponents Core 4.4.5 et Apache HttpComponents Client 4.5.2 (httpcore-4.4.5.jar et httpclient-4.5.2.jar).
- API de traitement JSON JSR 353 1.0 et JSR 353 API de fournisseur de traitement JSON par défaut 1.0.4 (javax.json-api-1.0.jar et javax.json-1.0.4.jar).
Programme principal et importations
L’exemple suivant montre les instructions d’importation utilisées par tous les exemples de code et implémente un programme de ligne de commande qui appelle les autres exemples de méthodes.
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.*;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.entity.FileEntity;
import org.apache.http.entity.StringEntity;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
public class IngestionServiceJavaSamples {
public static void main(String[] args) throws InterruptedException, URISyntaxException, IOException {
// Generate access token. Access token is valid for 1 hour. Regenerate access token when needed
String tenantId = ""; //{Your tenant ID}
String clientId = ""; //{Your client ID}
String clientSecret = ""; //{Your client secret}
String accessToken = GenerateAccessToken(tenantId, clientId, clientSecret);
// Application submission sample
String applicationId = ""; //{Your application ID}
String appSubmissionRequestJson = ""; //{Your submission request JSON}
String appSubmissionZipFilePath = ""; //{Your zip file path}
SubmitNewApplicationSubmission(accessToken, applicationId, appSubmissionRequestJson,
appSubmissionZipFilePath);
// Flight samples
String flightId = ""; //{Your flight ID}
String flightRequestJson = ""; //{Your flight request JSON}
String flightSubmissionRequestJson = ""; //{Your submission request JSON}
String flightSubmissionZipFilePath = ""; //{Your zip file path}
CreateNewFlight(accessToken, applicationId, flightRequestJson);
SubmitNewFlightSubmission(accessToken, applicationId, flightId, flightSubmissionRequestJson,
flightSubmissionZipFilePath);
// In-app-product samples
String inAppProductId = ""; //{Your in-app-product ID}
String inAppProductRequestJson = ""; //{Your in-app-product request JSON}
String iapSubmissionRequestJson = ""; //{Your submission request JSON}
String iapSubmissionZipFilePath = ""; //{Your zip file path}
CreateNewInAppProduct(accessToken, inAppProductRequestJson);
SubmitNewInAppProductSubmission(accessToken, inAppProductId, iapSubmissionRequestJson,
iapSubmissionZipFilePath);
}
}
Obtenir un jeton d’accès Azure AD
L’exemple suivant indique comment obtenir un jeton d’accès Azure AD que vous pouvez utiliser pour appeler des méthodes dans l’API de soumission au Microsoft Store. Une fois le jeton obtenu, vous avez 60 minutes pour l’utiliser dans les appels à l’API de soumission au Microsoft Store avant expiration. Une fois le jeton arrivé à expiration, vous pouvez en générer un autre.
public static String GenerateAccessToken(String tenantId, String clientId, String clientSecret) {
// Generate access token. Access token is valid for 1 hour. Regenerate access token when needed
String tokenEndpoint = "https://login.microsoftonline.com/{0}/oauth2/token";
String tokenResource = "https://manage.devcenter.microsoft.com";
HttpPost tokenRequest = new HttpPost(MessageFormat.format(tokenEndpoint, tenantId));
String tokenRequestBody = MessageFormat.format(
"grant_type=client_credentials&client_id={0}&client_secret={1}&resource={2}",
clientId, clientSecret, tokenResource);
tokenRequest.setEntity(new StringEntity(tokenRequestBody, "utf-8"));
tokenRequest.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<String> responseHandler = new BasicResponseHandler();
try {
String tokenResponse = httpclient.execute(tokenRequest, responseHandler);
JsonReader reader = Json.createReader(new ByteArrayInputStream(tokenResponse.getBytes("UTF-8")));
String accessToken = reader.readObject().getString("access_token");
return accessToken;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
Créer une extension
L’exemple suivant indique comment créer et supprimer une extension.
public static void CreateNewInAppProduct(String accessToken, String inAppProductRequestJson)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Create a new in-app-product
HttpPost createInAppProductRequest = new HttpPost(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts");
createInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
createInAppProductRequest.addHeader("Content-type", "application/json");
createInAppProductRequest.addHeader("User-Agent", "Java");
createInAppProductRequest.setEntity(new StringEntity(inAppProductRequestJson));
JsonObject createInAppProductResponse = httpclient.execute(createInAppProductRequest,
responseHandler);
String inAppProductId = createInAppProductResponse.getString("id");
System.out.println(createInAppProductResponse.toString());
// Delete created in-app-product
HttpDelete deleteInAppProductRequest = new HttpDelete(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/" + inAppProductId);
deleteInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteInAppProductRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteInAppProductRequest, responseHandler);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
Crée une version d’évaluation du package
L’exemple suivant indique comment créer et supprimer une version d’évaluation du package.
public static void CreateNewFlight(String accessToken, String applicationId, String flightRequestJson)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Create a new flight, a flight submission will be created together with the flight
HttpPost createFlightRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights", applicationId));
createFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
createFlightRequest.addHeader("Content-type", "application/json");
createFlightRequest.setEntity(new StringEntity(flightRequestJson));
JsonObject createFlightResponse = httpclient.execute(createFlightRequest, responseHandler);
System.out.println(createFlightResponse.toString());
String flightId = createFlightResponse.getString("flightId");
String submissionId = createFlightResponse.getJsonObject("pendingFlightSubmission").getString("id");
// Delete created flight
HttpDelete deleteFlightRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}",
applicationId, flightId));
deleteFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
httpclient.execute(deleteFlightRequest, responseHandler);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
Créer une soumission d’applications
L’exemple suivant indique comment utiliser plusieurs méthodes dans l’API de soumission au Microsoft Store afin de créer une soumission d’applications. Pour ce faire, la SubmitNewApplicationSubmission
méthode crée une nouvelle soumission en tant que clone de la dernière soumission publiée, puis met à jour et valide l’envoi cloné dans l’Espace partenaires. Plus précisément, la SubmitNewApplicationSubmission
méthode effectue ces tâches :
- Pour commencer, la méthode obtient des données pour l’application spécifiée.
- Ensuite, elle supprime la soumission en attente de l’application, s’il en existe une.
- Cela fait, il crée une soumission pour l’application (la nouvelle soumission est une copie de la dernière soumission publiée).
- Il modifie certains détails de cette soumission, puis charge un nouveau package associé à cette dernière dans le Stockage Blob Azure.
- Ensuite, il met à jour et valide la nouvelle soumission dans l’Espace partenaires.
- Pour finir, elle vérifie régulièrement l’état de la nouvelle soumission jusqu’à ce que celle-ci soit validée.
public static void SubmitNewApplicationSubmission(String accessToken, String applicationId,
String appSubmissionRequestJson, String zipFilePath)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get application
HttpGet getApplicationRequest = new HttpGet(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/" + applicationId);
getApplicationRequest.addHeader("Authorization", "Bearer " + accessToken);
getApplicationRequest.addHeader("User-Agent", "Java");
JsonObject getApplicaiontResponse = httpclient.execute(getApplicationRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getApplicaiontResponse.getJsonObject(
"pendingApplicationSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions",
applicationId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.addHeader("User-Agent", "Java");
updateSubmissionRequest.setEntity(new StringEntity(appSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}/commit",
applicationId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
Créer une soumission d’extension
L’exemple suivant indique comment utiliser plusieurs méthodes dans l’API de soumission au Microsoft Store afin de créer une soumission d’extension. Pour ce faire, la SubmitNewInAppProductSubmission
méthode crée une nouvelle soumission en tant que clone de la dernière soumission publiée, puis met à jour et valide l’envoi cloné dans l’Espace partenaires. Plus précisément, la SubmitNewInAppProductSubmission
méthode effectue ces tâches :
- Pour commencer, la méthode obtient des données pour le module complémentaire spécifié.
- Ensuite, il supprime la soumission en attente de l’extension, s’il en existe une.
- Après cela, elle crée une soumission pour l’extension (la nouvelle soumission est une copie de la dernière soumission publiée).
- Elle charge une archive ZIP contenant des icônes associées à la soumission dans le Stockage Blob Azure.
- Ensuite, il met à jour et valide la nouvelle soumission dans l’Espace partenaires.
- Pour finir, elle vérifie régulièrement l’état de la nouvelle soumission jusqu’à ce que celle-ci soit validée.
public static void SubmitNewInAppProductSubmission(String accessToken, String inAppProductId,
String iapSubmissionRequestJson, String zipFilePath)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get the in-app-product
HttpGet getInAppProductRequest = new HttpGet(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/" + inAppProductId);
getInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
getInAppProductRequest.addHeader("User-Agent", "Java");
JsonObject getInAppProductResponse = httpclient.execute(getInAppProductRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getInAppProductResponse.getJsonObject(
"pendingInAppProductSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}",
inAppProductId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions",
inAppProductId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}",
inAppProductId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.setEntity(new StringEntity(iapSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}/commit",
inAppProductId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}/status",
inAppProductId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
Créer une soumission de version d’évaluation du package
L’exemple suivant indique comment utiliser plusieurs méthodes dans l’API de soumission au Microsoft Store afin de créer une soumission de version d’évaluation du package. Pour ce faire, la SubmitNewFlightSubmission
méthode crée une nouvelle soumission en tant que clone de la dernière soumission publiée, puis met à jour et valide l’envoi cloné dans l’Espace partenaires. Plus précisément, la SubmitNewFlightSubmission
méthode effectue ces tâches :
- Pour commencer, la méthode obtient des données pour la version d’évaluation du package spécifiée.
- Ensuite, il supprime la soumission en attente de la version d’évaluation du package, s’il en existe une.
- Cela fait, il crée une soumission pour la version d’évaluation du package (la nouvelle soumission est une copie de la dernière soumission publiée).
- Elle charge un nouveau package associé à la soumission dans le Stockage Blob Azure.
- Ensuite, il met à jour , puis valide la nouvelle soumission dans PartnerCenter.
- Pour finir, elle vérifie régulièrement l’état de la nouvelle soumission jusqu’à ce que celle-ci soit validée.
public static void SubmitNewFlightSubmission(String accessToken, String applicationId,
String flightId, String flightSubmissionRequestJson, String zipFilePath)
throws InterruptedException, URISyntaxException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get flight
HttpGet getFlightRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}", applicationId,
flightId));
getFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
getFlightRequest.addHeader("User-Agent", "Java");
JsonObject getFlightResponse = httpclient.execute(getFlightRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getFlightResponse.getJsonObject("pendingFlightSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions",
applicationId, flightId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.addHeader("User-Agent", "Java");
updateSubmissionRequest.setEntity(new StringEntity(flightSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}/commit",
applicationId, flightId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
Méthodes utilitaires pour charger des fichiers de soumission et gérer les réponses aux demandes
Les méthodes utilitaires suivantes illustrent ces tâches :
- Comment charger une archive ZIP contenant de nouvelles ressources pour une soumission d’application ou de module complémentaire à Stockage Blob Azure. Pour plus d’informations sur le chargement d’une archive ZIP dans Stockage Blob Azure pour les soumissions d’applications et de modules complémentaires, consultez les instructions pertinentes dans Créer une soumission d’application, Créer une soumission d’extension et Créer une soumission de version d’évaluation de package.
- Comment gérer les réponses aux demandes.
private static void UploadZipFile(String fileUploadUrl, String zipFilePath) throws IOException{
CloseableHttpClient httpclient = HttpClients.createDefault();
File uploadFile = new File(zipFilePath);
// Encode '+', otherwise it will be decoded as ' '
HttpPut uploadFileRequest = new HttpPut(fileUploadUrl.replace("+", "%2B"));
uploadFileRequest.addHeader("x-ms-blob-type", "BlockBlob");
uploadFileRequest.setEntity(new FileEntity(uploadFile));
CloseableHttpResponse uploadFileResponse;
try {
uploadFileResponse = httpclient.execute(uploadFileRequest);
System.out.println(uploadFileResponse.getStatusLine());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
private static ResponseHandler<JsonObject> CreateJsonResponseHandler(){
ResponseHandler<JsonObject> responseHandler = new ResponseHandler<JsonObject>() {
@Override
public JsonObject handleResponse(HttpResponse response) throws IOException {
StatusLine statusLine = response.getStatusLine();
HttpEntity entity = response.getEntity();
JsonObject returnValue = null;
if(entity != null){
JsonReader reader = Json.createReader(entity.getContent());
returnValue = reader.readObject();
}
// Log response status and correlation ID
System.out.println(statusLine);
System.out.println(response.getFirstHeader("MS-CorrelationId"));
// Underlying failure reason is in response entity
if (statusLine.getStatusCode() >= 300) {
if(entity == null){
throw new HttpResponseException(
statusLine.getStatusCode(),
statusLine.getReasonPhrase());
}
else{
throw new HttpResponseException(
statusLine.getStatusCode(),
statusLine.getReasonPhrase() + " " + returnValue.toString() );
}
}
return returnValue;
}
};
return responseHandler;
}
Listing du code complet
La liste de codes suivante contient tous les exemples précédents organisés en un seul fichier source.
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URISyntaxException;
import java.text.MessageFormat;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.*;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.entity.FileEntity;
import org.apache.http.entity.StringEntity;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
public class IngestionServiceJavaSamples {
public static void main(String[] args) throws InterruptedException, URISyntaxException, IOException {
// Generate access token. Access token is valid for 1 hour. Regenerate access token when needed
String tenantId = ""; //{Your tenant ID}
String clientId = ""; //{Your client ID}
String clientSecret = ""; //{Your client secret}
String accessToken = GenerateAccessToken(tenantId, clientId, clientSecret);
// Application submission sample
String applicationId = ""; //{Your application ID}
String appSubmissionRequestJson = ""; //{Your submission request JSON}
String appSubmissionZipFilePath = ""; //{Your zip file path}
SubmitNewApplicationSubmission(accessToken, applicationId, appSubmissionRequestJson,
appSubmissionZipFilePath);
// Flight samples
String flightId = ""; //{Your flight ID}
String flightRequestJson = ""; //{Your flight request JSON}
String flightSubmissionRequestJson = ""; //{Your submission request JSON}
String flightSubmissionZipFilePath = ""; //{Your zip file path}
CreateNewFlight(accessToken, applicationId, flightRequestJson);
SubmitNewFlightSubmission(accessToken, applicationId, flightId, flightSubmissionRequestJson,
flightSubmissionZipFilePath);
// In-app-product samples
String inAppProductId = ""; //{Your in-app-product ID}
String inAppProductRequestJson = ""; //{Your in-app-product request JSON}
String iapSubmissionRequestJson = ""; //{Your submission request JSON}
String iapSubmissionZipFilePath = ""; //{Your zip file path}
CreateNewInAppProduct(accessToken, inAppProductRequestJson);
SubmitNewInAppProductSubmission(accessToken, inAppProductId, iapSubmissionRequestJson,
iapSubmissionZipFilePath);
}
public static String GenerateAccessToken(String tenantId, String clientId, String clientSecret) {
// Generate access token. Access token is valid for 1 hour. Regenerate access token when needed
String tokenEndpoint = "https://login.microsoftonline.com/{0}/oauth2/token";
String tokenResource = "https://manage.devcenter.microsoft.com";
HttpPost tokenRequest = new HttpPost(MessageFormat.format(tokenEndpoint, tenantId));
String tokenRequestBody = MessageFormat.format(
"grant_type=client_credentials&client_id={0}&client_secret={1}&resource={2}",
clientId, clientSecret, tokenResource);
tokenRequest.setEntity(new StringEntity(tokenRequestBody, "utf-8"));
tokenRequest.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<String> responseHandler = new BasicResponseHandler();
try {
String tokenResponse = httpclient.execute(tokenRequest, responseHandler);
JsonReader reader = Json.createReader(new ByteArrayInputStream(tokenResponse.getBytes("UTF-8")));
String accessToken = reader.readObject().getString("access_token");
return accessToken;
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public static void SubmitNewApplicationSubmission(String accessToken, String applicationId,
String appSubmissionRequestJson, String zipFilePath)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get application
HttpGet getApplicationRequest = new HttpGet(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/" + applicationId);
getApplicationRequest.addHeader("Authorization", "Bearer " + accessToken);
getApplicationRequest.addHeader("User-Agent", "Java");
JsonObject getApplicaiontResponse = httpclient.execute(getApplicationRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getApplicaiontResponse.getJsonObject(
"pendingApplicationSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions",
applicationId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.addHeader("User-Agent", "Java");
updateSubmissionRequest.setEntity(new StringEntity(appSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}/commit",
applicationId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/submissions/{1}",
applicationId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
public static void CreateNewFlight(String accessToken, String applicationId, String flightRequestJson)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Create a new flight, a flight submission will be created together with the flight
HttpPost createFlightRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights", applicationId));
createFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
createFlightRequest.addHeader("Content-type", "application/json");
createFlightRequest.setEntity(new StringEntity(flightRequestJson));
JsonObject createFlightResponse = httpclient.execute(createFlightRequest, responseHandler);
System.out.println(createFlightResponse.toString());
String flightId = createFlightResponse.getString("flightId");
String submissionId = createFlightResponse.getJsonObject("pendingFlightSubmission").getString("id");
// Delete created flight
HttpDelete deleteFlightRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}",
applicationId, flightId));
deleteFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
httpclient.execute(deleteFlightRequest, responseHandler);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
public static void SubmitNewFlightSubmission(String accessToken, String applicationId,
String flightId, String flightSubmissionRequestJson, String zipFilePath)
throws InterruptedException, URISyntaxException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get flight
HttpGet getFlightRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}", applicationId,
flightId));
getFlightRequest.addHeader("Authorization", "Bearer " + accessToken);
getFlightRequest.addHeader("User-Agent", "Java");
JsonObject getFlightResponse = httpclient.execute(getFlightRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getFlightResponse.getJsonObject("pendingFlightSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions",
applicationId, flightId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.addHeader("User-Agent", "Java");
updateSubmissionRequest.setEntity(new StringEntity(flightSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}/commit",
applicationId, flightId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/applications/{0}/flights/{1}/submissions/{2}",
applicationId, flightId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
public static void CreateNewInAppProduct(String accessToken, String inAppProductRequestJson)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Create a new in-app-product
HttpPost createInAppProductRequest = new HttpPost(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts");
createInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
createInAppProductRequest.addHeader("Content-type", "application/json");
createInAppProductRequest.addHeader("User-Agent", "Java");
createInAppProductRequest.setEntity(new StringEntity(inAppProductRequestJson));
JsonObject createInAppProductResponse = httpclient.execute(createInAppProductRequest,
responseHandler);
String inAppProductId = createInAppProductResponse.getString("id");
System.out.println(createInAppProductResponse.toString());
// Delete created in-app-product
HttpDelete deleteInAppProductRequest = new HttpDelete(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/" + inAppProductId);
deleteInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteInAppProductRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteInAppProductRequest, responseHandler);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
public static void SubmitNewInAppProductSubmission(String accessToken, String inAppProductId,
String iapSubmissionRequestJson, String zipFilePath)
throws InterruptedException, IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
ResponseHandler<JsonObject> responseHandler = CreateJsonResponseHandler();
try {
// Get the in-app-product
HttpGet getInAppProductRequest = new HttpGet(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/" + inAppProductId);
getInAppProductRequest.addHeader("Authorization", "Bearer " + accessToken);
getInAppProductRequest.addHeader("User-Agent", "Java");
JsonObject getInAppProductResponse = httpclient.execute(getInAppProductRequest, responseHandler);
// Delete existing in-progress submission
JsonObject submissionToRemove = getInAppProductResponse.getJsonObject(
"pendingInAppProductSubmission");
if(submissionToRemove != null){
String submissionToRemoveId = submissionToRemove.getString("id");
HttpDelete deleteSubmissionRequest = new HttpDelete(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}",
inAppProductId, submissionToRemoveId));
deleteSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
deleteSubmissionRequest.addHeader("User-Agent", "Java");
httpclient.execute(deleteSubmissionRequest, responseHandler);
}
// Create submission
HttpPost createSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions",
inAppProductId));
createSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
createSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject createSubmissionResponse = httpclient.execute(createSubmissionRequest, responseHandler);
String submissionId = createSubmissionResponse.getString("id");
String fileUploadUrl = createSubmissionResponse.getString("fileUploadUrl");
// Update submission
HttpPut updateSubmissionRequest = new HttpPut(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}",
inAppProductId, submissionId));
updateSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
updateSubmissionRequest.addHeader("Content-type", "application/json");
updateSubmissionRequest.setEntity(new StringEntity(iapSubmissionRequestJson));
JsonObject updateSubmissionResponse = httpclient.execute(updateSubmissionRequest, responseHandler);
// Upload images and packages in a zip file
UploadZipFile(fileUploadUrl, zipFilePath);
// Commit submission
HttpPost commitSubmissionRequest = new HttpPost(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}/commit",
inAppProductId, submissionId));
commitSubmissionRequest.addHeader("Authorization", "Bearer " + accessToken);
commitSubmissionRequest.addHeader("User-Agent", "Java");
JsonObject commitSubmissionResponse = httpclient.execute(commitSubmissionRequest, responseHandler);
System.out.println(commitSubmissionResponse.getString("status"));
// Pull submission status until commit process is completed
HttpGet getSubmissionStatusRequest = new HttpGet(MessageFormat.format(
"https://manage.devcenter.microsoft.com/v1.0/my/inappproducts/{0}/submissions/{1}/status",
inAppProductId, submissionId));
getSubmissionStatusRequest.addHeader("Authorization", "Bearer " + accessToken);
getSubmissionStatusRequest.addHeader("User-Agent", "Java");
JsonObject getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest,
responseHandler);
String submissionStatus = getSubmissionStatusResponse.getString("status");
while(submissionStatus.equals("CommitStarted")){
Thread.sleep(60*1000);
getSubmissionStatusResponse = httpclient.execute(getSubmissionStatusRequest, responseHandler);
submissionStatus = getSubmissionStatusResponse.getString("status");
}
System.out.println(submissionStatus);
} catch (HttpResponseException e){
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
private static void UploadZipFile(String fileUploadUrl, String zipFilePath) throws IOException{
CloseableHttpClient httpclient = HttpClients.createDefault();
File uploadFile = new File(zipFilePath);
// Encode '+', otherwise it will be decoded as ' '
HttpPut uploadFileRequest = new HttpPut(fileUploadUrl.replace("+", "%2B"));
uploadFileRequest.addHeader("x-ms-blob-type", "BlockBlob");
uploadFileRequest.setEntity(new FileEntity(uploadFile));
CloseableHttpResponse uploadFileResponse;
try {
uploadFileResponse = httpclient.execute(uploadFileRequest);
System.out.println(uploadFileResponse.getStatusLine());
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {
httpclient.close();
}
}
private static ResponseHandler<JsonObject> CreateJsonResponseHandler(){
ResponseHandler<JsonObject> responseHandler = new ResponseHandler<JsonObject>() {
@Override
public JsonObject handleResponse(HttpResponse response) throws IOException {
StatusLine statusLine = response.getStatusLine();
HttpEntity entity = response.getEntity();
JsonObject returnValue = null;
if(entity != null){
JsonReader reader = Json.createReader(entity.getContent());
returnValue = reader.readObject();
}
// Log response status and correlation ID
System.out.println(statusLine);
System.out.println(response.getFirstHeader("MS-CorrelationId"));
// Underlying failure reason is in response entity
if (statusLine.getStatusCode() >= 300) {
if(entity == null){
throw new HttpResponseException(
statusLine.getStatusCode(),
statusLine.getReasonPhrase());
}
else{
throw new HttpResponseException(
statusLine.getStatusCode(),
statusLine.getReasonPhrase() + " " + returnValue.toString() );
}
}
return returnValue;
}
};
return responseHandler;
}
}