Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
FAQ.adullact.org
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adullact
FAQ.adullact.org
Commits
f0285e17
Commit
f0285e17
authored
3 years ago
by
Fabrice Gangler
Browse files
Options
Downloads
Patches
Plain Diff
REFACTOR(content): move 77-comment-utiliser-les-apis-s2low-en-java (18)
parent
05e14eb7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab/ci/build_additional_files/.htaccess
+2
-1
2 additions, 1 deletion
.gitlab/ci/build_additional_files/.htaccess
FAQ_articles/services-adullact/s2low/utiliser-api-s2low-en-java/_index.md
+90
-0
90 additions, 0 deletions
...vices-adullact/s2low/utiliser-api-s2low-en-java/_index.md
with
92 additions
and
1 deletion
.gitlab/ci/build_additional_files/.htaccess
+
2
−
1
View file @
f0285e17
...
@@ -204,7 +204,7 @@ ErrorDocument 404 /404.html
...
@@ -204,7 +204,7 @@ ErrorDocument 404 /404.html
RewriteRule
^technique/13-certificat-demande-serveur-s2low$ /services-adullact/s2low/13-certificat-demande-serveur-s2low/ [L,R=301]
RewriteRule
^technique/13-certificat-demande-serveur-s2low$ /services-adullact/s2low/13-certificat-demande-serveur-s2low/ [L,R=301]
RewriteRule
^technique/16-certificats-electroniques-et-dispositifs-de-teletransmission$ /services-adullact/s2low/16-certificats-electroniques-et-dispositifs-de-teletransmission/ [L,R=301]
RewriteRule
^technique/16-certificats-electroniques-et-dispositifs-de-teletransmission$ /services-adullact/s2low/16-certificats-electroniques-et-dispositifs-de-teletransmission/ [L,R=301]
RewriteRule
^technique/76-comment-creer-un-tunnel-ssh$ /technique/76-comment-creer-un-tunnel-ssh/ [L,R=301]
RewriteRule
^technique/76-comment-creer-un-tunnel-ssh$ /technique/76-comment-creer-un-tunnel-ssh/ [L,R=301]
RewriteRule
^technique/77-comment-utiliser-les-apis-s2low-en-java$ /services-adullact/s2low/77-comment-utiliser-les-apis-s2low-en-java/ [L,R=301]
#
RewriteRule ^technique/77-comment-utiliser-les-apis-s2low-en-java$ /services-adullact/s2low/77-comment-utiliser-les-apis-s2low-en-java/ [L,R=301]
RewriteRule
^technique/80-jeu-de-caracteres-pour-une-application-web$ /technique/80-jeu-de-caracteres-pour-une-application-web/ [L,R=301]
RewriteRule
^technique/80-jeu-de-caracteres-pour-une-application-web$ /technique/80-jeu-de-caracteres-pour-une-application-web/ [L,R=301]
# RewriteRule ^technique/90-comment-utiliser-les-apis-s2low-en-php$ /services-adullact/s2low/90-comment-utiliser-les-apis-s2low-en-php/ [L,R=301]
# RewriteRule ^technique/90-comment-utiliser-les-apis-s2low-en-php$ /services-adullact/s2low/90-comment-utiliser-les-apis-s2low-en-php/ [L,R=301]
RewriteRule
^technique?start=10$ /technique/ [L,R=301]
RewriteRule
^technique?start=10$ /technique/ [L,R=301]
...
@@ -233,6 +233,7 @@ ErrorDocument 404 /404.html
...
@@ -233,6 +233,7 @@ ErrorDocument 404 /404.html
# S2low
# S2low
RewriteRule
^technique/90-comment-utiliser-les-apis-s2low-en-php$ /services-adullact/s2low/utiliser-api-s2low-en-php/ [L,R=301]
RewriteRule
^technique/90-comment-utiliser-les-apis-s2low-en-php$ /services-adullact/s2low/utiliser-api-s2low-en-php/ [L,R=301]
RewriteRule
^technique/77-comment-utiliser-les-apis-s2low-en-java$ /services-adullact/s2low/utiliser-api-s2low-en-java/ [L,R=301]
# Other URL
# Other URL
RewriteRule
^index.php/mentions-legales$ /mentions-legales/ [L,R=301]
RewriteRule
^index.php/mentions-legales$ /mentions-legales/ [L,R=301]
...
...
This diff is collapsed.
Click to expand it.
FAQ_articles/services-adullact/s2low/
77-comment-
utiliser-
les-
api
s
-s2low-en-java.md
→
FAQ_articles/services-adullact/s2low/utiliser-api-s2low-en-java
/_index
.md
+
90
−
0
View file @
f0285e17
...
@@ -6,8 +6,6 @@ date = "2010-02-25"
...
@@ -6,8 +6,6 @@ date = "2010-02-25"
+++
+++
{{
<
toc
>
}}
{{
<
toc
>
}}
Prérequis pour la mise en production de
De plus en plus de collectivités souhaitent automatiser les échanges dématérialisés, et cela passe naturellement par
De plus en plus de collectivités souhaitent automatiser les échanges dématérialisés, et cela passe naturellement par
la mise en place de dialogue inter-application.
la mise en place de dialogue inter-application.
...
@@ -26,67 +24,67 @@ connexion par certificat (package Apache EasySSLProtocolSocketFactory), d'utilis
...
@@ -26,67 +24,67 @@ connexion par certificat (package Apache EasySSLProtocolSocketFactory), d'utilis
résultat.
résultat.
```
Java
```
Java
1 import java.io.IOException;
1 import java.io.IOException;
2 import java.security.KeyManagementException;
2 import java.security.KeyManagementException;
3 import java.security.KeyStoreException;
3 import java.security.KeyStoreException;
4 import java.security.NoSuchAlgorithmException;
4 import java.security.NoSuchAlgorithmException;
5 import java.security.UnrecoverableKeyException;
5 import java.security.UnrecoverableKeyException;
6 import java.security.cert.CertificateException;
6 import java.security.cert.CertificateException;
7 import org.apache.commons.httpclient.HttpClient;
7 import org.apache.commons.httpclient.HttpClient;
8 import org.apache.commons.httpclient.HttpStatus;
8 import org.apache.commons.httpclient.HttpStatus;
9 import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory;
9 import org.apache.commons.httpclient.contrib.ssl.EasySSLProtocolSocketFactory;
10 import org.apache.commons.httpclient.methods.GetMethod;
10 import org.apache.commons.httpclient.methods.GetMethod;
11 import org.apache.commons.httpclient.protocol.Protocol;
11 import org.apache.commons.httpclient.protocol.Protocol;
12 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
12 import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
13 import org.apache.commons.ssl.KeyMaterial;
13 import org.apache.commons.ssl.KeyMaterial;
14
14
15 class ConnecteurS2low {
15 class ConnecteurS2low {
16 private int getInfosS2lowActes(String TRANSACTION\_ID)
16 private int getInfosS2lowActes(String TRANSACTION\_ID)
throws IOException, NoSuchAlgorithmException,
throws IOException, NoSuchAlgorithmException,
KeyStoreException, KeyManagementException,
KeyStoreException, KeyManagementException,
CertificateException, UnrecoverableKeyException {
CertificateException, UnrecoverableKeyException {
17 //Map propertiesActes = getPropertiesActes();
17 //Map propertiesActes = getPropertiesActes();
18 String passwordCertificat = "password";
18 String passwordCertificat = "password";
19 String serverAddress = "demo-s2low.demonstrations.adullact.org";
19 String serverAddress = "demo-s2low.demonstrations.adullact.org";
20 String port = "443";
20 String port = "443";
21 int codeRetour = -1;
21 int codeRetour = -1;
22
22
23 EasySSLProtocolSocketFactory easy = new EasySSLProtocolSocketFactory();
23 EasySSLProtocolSocketFactory easy = new EasySSLProtocolSocketFactory();
24 KeyMaterial km = new KeyMaterial(readFile("/etc/certificats/monCertificat.p12"),
24 KeyMaterial km = new KeyMaterial(readFile("/etc/certificats/monCertificat.p12"),
25 passwordCertificat.toCharArray());
25 passwordCertificat.toCharArray());
26 easy.setKeyMaterial(km);
26 easy.setKeyMaterial(km);
27 Protocol easyhttps = new Protocol("https",
27 Protocol easyhttps = new Protocol("https",
(ProtocolSocketFactory) easy,
(ProtocolSocketFactory) easy,
Integer.parseInt(port));
Integer.parseInt(port));
28 Protocol.registerProtocol("https", easyhttps);
28 Protocol.registerProtocol("https", easyhttps);
29 HttpClient client = new HttpClient();
29 HttpClient client = new HttpClient();
30 GetMethod get = new GetMethod("https://" + serverAddress + ":" +
30 GetMethod get = new GetMethod("https://" + serverAddress + ":" +
31 port +
31 port +
32 "/modules/actes/actes\_transac\_get\_status.php?transaction=" +
32 "/modules/actes/actes\_transac\_get\_status.php?transaction=" +
33 TRANSACTION\_ID);
33 TRANSACTION\_ID);
34 try {
34 try {
35 int status = client.executeMethod(get);
35 int status = client.executeMethod(get);
36 if (HttpStatus.SC\_OK == status) {
36 if (HttpStatus.SC\_OK == status) {
37 String reponse = get.getResponseBodyAsString();
37 String reponse = get.getResponseBodyAsString();
38 String\[\] tab = reponse.split("\\n");
38 String\[\] tab = reponse.split("\\n");
39 if (tab.length == 1 || "KO".equals(tab\[0\])) {
39 if (tab.length == 1 || "KO".equals(tab\[0\])) {
40 String error = "Erreur retournee par la plate-forme s2low: ";
40 String error = "Erreur retournee par la plate-forme s2low: ";
41 for (int i = 1; i < tab.length; i++) {
41 for (int i = 1; i < tab.length; i++) {
42 error += tab\[i\];
42 error += tab\[i\];
43 }
43 }
44 throw new RuntimeException(error);
44 throw new RuntimeException(error);
45 }
45 }
46 // La transaction s'est bien passee, on renvoie le statut (ligne 2)
46 // La transaction s'est bien passee, on renvoie le statut (ligne 2)
47 codeRetour = Integer.parseInt(tab\[1\]);
47 codeRetour = Integer.parseInt(tab\[1\]);
48 } else {
48 } else {
49 throw new RuntimeException(
49 throw new RuntimeException(
"Echec de la recuperation de la connexion: statut = "
"Echec de la recuperation de la connexion: statut = "
+ status);
+ status);
50 }
50 }
51 } finally {
51 } finally {
52 get.releaseConnection();
52 get.releaseConnection();
53 }
53 }
54 return codeRetour;
54 return codeRetour;
55 }
55 }
56 }
56 }
`̀``
`̀``
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment