Lire un fichier via tFileFetch sur un serveur https avec un certificat

One Star

Lire un fichier via tFileFetch sur un serveur https avec un certificat

Bonjour,
Je dois créer un job Talend (4.1) qui récupère un fichier depuis une url https://serveur/question?param1=xxx&param2=yyy ... sachant qu'un certificat est necessaire.
J'arrive a récupérer le fichier en saisissant l'url dans mon navigateur (auquel j'ai ajouté le certificat), mais impossible de le faire via Talend avec tFileFetch.
Mon job dispose d'un premier composant tSetKeyStore, mais je ne sais pas si j'ai correctement défini les paramètres.
Tout ce dont je dispose c'est d'un fichier de certificat xxxxx.p12 et d'un mot de passe.
Pouvez-vous m'aider ?
D'avance Merci !
Six Stars

Re: Lire un fichier via tFileFetch sur un serveur https avec un certificat

What exactly is the problem you are facing? Is it a certificate issue? Can you post the error?
Moderator

Re: Lire un fichier via tFileFetch sur un serveur https avec un certificat

Hi badgamme,
This is an international forum and English is the language we use. Posting in English will allow you to get more visibility and more help. Thanks for your understanding!
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Lire un fichier via tFileFetch sur un serveur https avec un certificat

Ok, let's try in english !
My Job have to retrieve a file from a URL like this https://serveur/question?param1=xxx&param2=yyy
I've got a certificate (filename.p12), and have made a successfull test from my browser.
I red some stuff about certificate & java and have made the following :
- Build a keystore file using KeyToolIUI,
- Exporting the certificate from FireFox to obtain a .pem file
- Importing this pem file into the keyStore with keytool
The Talend job has 2 components :
- tKeyStore : to set the certificate
- no trusStoreFile specified
- client authentication checked
- KeyStore type = JKS
- KeyStore file = the name of the keystore file builded above with keyTool IUI
- KeyStore password = set to the password of the KeyStore
- tFileFetch : to retreive the file
- URI : set to https://serveur/question
- dest directory : set to my fileSystem
- Dest file : the name of the file te write
- ...
- advanced params :
- Need authentication : user and password for my certificate
This is the result :
here is an exception on: https://www.recherche-beneficiaires.fr/demande
javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:502)
at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:324)
at echantillon.filefetch_0_1.fileFetch.tFileFetch_1Process(fileFetch.java:507)
at echantillon.filefetch_0_1.fileFetch.tSetKeystore_1Process(fileFetch.java:303)
at echantillon.filefetch_0_1.fileFetch.runJobInTOS(fileFetch.java:784)
at echantillon.filefetch_0_1.fileFetch.main(fileFetch.java:655)
ANy idea of what's going wrong ?
One Star

Re: Lire un fichier via tFileFetch sur un serveur https avec un certificat

I also tryed with the original .p12 file in the tKeyStore component (changing the KeyStore type to PKCS12) and have the same response.
The component tKeyStore is "OK", then the component tFileFetch starts and I get the above error.