ComposantsComponents

ComposantsComponents › ESB › REST

tRESTClient

tRESTClient

ESB › REST

Appelle un service REST et en donne la réponse : le code de statut et le corps, en Document (XML, ou JSON converti en XML) ou en chaîne. Il fait un appel par ligne reçue, ou un seul s'il commence le sous-job. Les réponses en erreur (code 300 et au-delà) sortent par un lien à part.Calls a REST service and gives its response: the status code and the body, as a Document (XML, or JSON converted to XML) or as a string. It makes one call per row received, or a single one if it starts the subjob. The error responses (code 300 and above) come out through a separate link.

EntréeInput

Un lien Main, facultatif : un appel par ligne ; sa colonne body (Document) ou string (String) est le corps de la requête.One Main link, optional: one call per row; its body (Document) or string (String) column is the body of the request.

SortieOutput

Response la réponse (statusCode, body, string) ; Erreur la réponse en erreur (errorCode, errorMessage).Response the response (statusCode, body, string); Error the error response (errorCode, errorMessage).

Déclencheurs en sortieOutput triggers

On Subjob Ok On Subjob Error On Component Ok On Component Error Run if

UtilisationUsage

Lire une ressourceRead a resource

row1 (Response)row2 (Main)tRESTClient_1tExtractXMLField_1tLogRow_1

Le tRESTClient commence le sous-job et fait un seul appel GET. La colonne body de la réponse est un Document, à découper ensuite (tExtractXMLField, tXMLMap).The tRESTClient starts the subjob and makes a single GET call. The body column of the response is a Document, to be split next (tExtractXMLField, tXMLMap).

Un appel par ligne, succès et erreursOne call per row, successes and errors

row1 (Main)row2 (Response)row3 (Error)tFixedFlowInput_1tRESTClient_1tLogRow_1tLogRow_2

Chaque ligne déclenche un appel. Les paramètres du composant peuvent lire la ligne : Chemin relatif "/" + row1.id. Pour envoyer un corps, la ligne doit avoir une colonne body ou string.Each row triggers a call. The settings of the component can read the row: Relative Path "/" + row1.id. To send a body, the row must have a body or string column.

  1. Déposez le tRESTClient depuis la famille ESB › REST de la palette. Donnez l'URL du service et, au besoin, le Chemin relatif de la ressource.Drop the tRESTClient from the ESB › REST family of the palette. Give the URL of the service and, if needed, the Relative Path of the resource.
  2. Choisissez la Méthode HTTP, le type accepté et, pour POST, PUT et PATCH, le type du contenu envoyé.Choose the HTTP Method, the accepted type and, for POST, PUT and PATCH, the type of the content sent.
  3. Pour envoyer un corps, reliez en entrée un flux qui a une colonne body de type Document ou une colonne string de type String.To send a body, connect as input a flow that has a body column of type Document or a string column of type String.
  4. Tracez le lien Response (clic droit › Ligne › Response) et, pour traiter les réponses en erreur sans arrêter le job, le lien Erreur.Draw the Response link (right-click › Row › Response) and, to handle the error responses without stopping the job, the Error link.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant ; le nom technique, en gris, est celui du paramètre dans le fichier du job. Les listes enregistrent leur valeur technique (application/json, */*).Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The lists store their technical value (application/json, */*).

ParamètreSetting DéfautDefault VisibleShown Description
URLURLURL "" Service Locator décochéService Locator unchecked Adresse du service, expression Java : "http://localhost:8088/clients".Address of the service, a Java expression: "http://localhost:8088/clients".
Chemin relatifRelative PathPATH "" ToujoursAlways Ajouté à l'URL : "/2", "/" + row1.id. Peut rester vide.Appended to the URL: "/2", "/" + row1.id. May stay empty.
Méthode HTTPHTTP MethodMETHOD GET ToujoursAlways GET, POST, PUT, PATCH ou DELETE.GET, POST, PUT, PATCH or DELETE.
Type de contenuContent TypeCONTENT_TYPE XML POST, PUT, PATCHPOST, PUT, PATCH En-tête Content-Type de la requête : XML (application/xml), JSON (application/json, un corps Document est converti en JSON) ou FORM (application/x-www-form-urlencoded).Content-Type header of the request: XML (application/xml), JSON (application/json, a Document body is converted to JSON) or FORM (application/x-www-form-urlencoded).
Accepter typeAccept TypeACCEPT_TYPE XML Sauf DELETEExcept DELETE En-tête Accept : XML, JSON, Multipart (multipart/mixed) ou tous (*/*). Décide aussi de la colonne remplie : body pour XML et JSON, string pour tous et Multipart.Accept header: XML, JSON, Multipart (multipart/mixed) or any (*/*). Also decides which column is filled: body for XML and JSON, string for any and Multipart.
Paramètres de la requêteQuery parametersQUERY videempty ToujoursAlways Table nom / valeur, deux expressions Java, ajoutée à l'adresse : ?city=Paris. Avec le type de contenu FORM, ces lignes deviennent les champs du formulaire, envoyés dans le corps.name / value table, two Java expressions, appended to the address: ?city=Paris. With the FORM content type, these rows become the fields of the form, sent in the body.
Schéma d'entréeInput SchemaINPUT_SCHEMA body, string ToujoursAlways En lecture seule : voir Les schémas.Read-only: see The schemas.
Schéma ResponseResponse SchemaSCHEMA_RESPONSE statusCode, body, string ToujoursAlways En lecture seule.Read-only.
Schéma ErrorError SchemaSCHEMA_FAULT errorCode, errorMessage ToujoursAlways En lecture seule.Read-only.
Utiliser le Service LocatorUse Service LocatorSERVICE_LOCATOR NonNo ToujoursAlways Demande l'adresse du service au Service Locator de Talend ESB au lieu de la lire dans URL.Asks the Service Locator of Talend ESB for the address of the service instead of reading it from URL.
Espace de noms de ServiceService namespaceSERVICE_NAMESPACE Préférence ESB (http://www.talend.org/rest/)ESB preference (http://www.talend.org/rest/) Service Locator cochéService Locator checked Espace de noms sous lequel le service est enregistré.Namespace under which the service is registered.
Nom du serviceService nameSERVICE_NAME "" Service Locator cochéService Locator checked Nom sous lequel le service est enregistré : celui du job qui le publie par un tRESTRequest.Name under which the service is registered: the one of the job that publishes it with a tRESTRequest.
Utiliser Service Activity MonitorUse Service Activity MonitorSERVICE_ACTIVITY_MONITOR NonNo ToujoursAlways Envoie les événements de l'appel au Service Activity Monitor (SAM) de Talend ESB.Sends the events of the call to the Service Activity Monitor (SAM) of Talend ESB.
Utiliser l'authentificationUse AuthenticationNEED_AUTH NonNo ToujoursAlways Ajoute une authentification à la requête.Adds an authentication to the request.
Type d'authentificationAuthentication TypeAUTH_TYPE Basic HTTP Authentification cochéeAuthentication checked Basic HTTP, HTTP Digest, Jeton SAML (ESB Runtime uniquement) ou OAuth2 Bearer. OpenID Connect n'est proposé que dans l'édition entreprise.Basic HTTP, HTTP Digest, SAML Token (ESB runtime only) or OAuth2 Bearer. Open ID Connect is only offered in the enterprise edition.
UtilisateurUsernameAUTH_USERNAME "username" Authentification, sauf OAuth2 BearerAuthentication, except OAuth2 Bearer Nom de l'utilisateur.Name of the user.
Mot de passePasswordAUTH_PASSWORD "password" Authentification, sauf OAuth2 BearerAuthentication, except OAuth2 Bearer Mot de passe, chiffré dans le fichier du job.Password, encrypted in the job file.
Jeton BearerBearer TokenAUTH_BEARER_TOKEN "" OAuth2 BearerOAuth2 Bearer Jeton envoyé dans l'en-tête Authorization: Bearer …. Le composant ne l'obtient pas lui-même : demandez-le avant, par un premier appel.Token sent in the Authorization: Bearer … header. The component does not obtain it by itself: request it beforehand, with a first call.
Utiliser autorisation / RôleUse Authorization / RoleNEED_AUTHORIZATION, ROLE NonNo Édition entreprise, avec Jeton SAMLEnterprise edition, with SAML Token Rôle demandé avec le jeton SAML.Role requested with the SAML token.
Utiliser la Corrélation MétierUse Business CorrelationUSE_BUSINESS_CORRELATION NonNo ToujoursAlways Joint un identifiant de corrélation à l'appel ; celui de la réponse est dans la variable CORRELATION_ID.Attaches a correlation identifier to the call; the one of the response is in the CORRELATION_ID variable.
Valeur de corrélationCorrelation ValueCORRELATION_VALUE "" Corrélation cochéeCorrelation checked Identifiant à envoyer ; vide, il est créé.Identifier to send; empty, one is created.
Vérifier l'identité du serveurCheck Server IdentityCHECK_SERVER_IDENTITY OuiYes ToujoursAlways En HTTPS, vérifie que le nom du certificat est celui du serveur appelé. Décochée, ce contrôle du nom est désactivé.In HTTPS, checks that the name of the certificate is the one of the called server. Unchecked, this name check is disabled.
Réutiliser la connexion SSLRe-use SSL connectionREUSE_SSL_CONNECTION NonNo ToujoursAlways Garde le client HTTP dans globalMap et le reprend pour les appels suivants à la même URL, au lieu d'en créer un par ligne. Utile bien au-delà du SSL : voir Pièges.Keeps the HTTP client in globalMap and takes it again for the next calls to the same URL, instead of creating one per row. Useful well beyond SSL: see Pitfalls.
Arrêter en cas d'erreurDie on errorDIE_ON_ERROR OuiYes ToujoursAlways Cochée, une erreur arrête le job. Décochée, elle est écrite sur la sortie d'erreur et le flux continue. Voir Réponses en erreur.Checked, an error stops the job. Unchecked, it is written to the error output and the flow goes on. See Error responses.

Paramètres avancésAdvanced settings

ParamètreSetting DéfautDefault VisibleShown Description
Messages de logLog messagesLOG_MESSAGES NonNo ToujoursAlways Journalise la requête et la réponse (en-tête Authorization et éléments password masqués), au niveau INFO du journal du job. Lancé depuis Talaxie sans configuration de journal, le job n'en a rien affiché dans la console lors de nos essais.Logs the request and the response (Authorization header and password elements masked), at the INFO level of the job log. Started from Talaxie with no log configuration, the job displayed none of it in the console in our runs.
Suivre les redirectionsFollow redirectsFOLLOW_REDIRECTS NonNo ToujoursAlways Suit les réponses 3xx vers la nouvelle adresse. Décochée, une redirection est une réponse en erreur.Follows the 3xx responses to the new address. Unchecked, a redirect is an error response.
Autoriser les redirections vers des hôtes différentsAllow non-same host redirectsREDIRECT_NON_SAME_HOST NonNo Redirections cochéesRedirects checked Sinon, seules les redirections vers le même hôte sont suivies.Otherwise, only the redirects to the same host are followed.
Maintenir la sessionMaintain sessionMAINTAIN_SESSION NonNo Redirections cochéesRedirects checked Renvoie les cookies reçus pendant les redirections.Sends back the cookies received during the redirects.
Activer le reporting des opérations du client WebEnable WebClient Operation ReportingENABLE_WEBCLIENT_OPERATION_REPORTING OuiYes ToujoursAlways Propriété enable.webclient.operation.reporting de CXF : nomme l'opération dans les événements de suivi.enable.webclient.operation.reporting property of CXF: names the operation in the monitoring events.
Convertir la réponse en document DOMConvert Response To DOM DocumentCONVERT_RESPONSE_TO_DOM OuiYes Sauf type accepté « tous »Except "any" accept type Cochée, la réponse est un Document dans body. Décochée, elle reste le texte reçu, dans string.Checked, the response is a Document in body. Unchecked, it stays the text received, in string.
Retirer la racine de la requête JSONDrop JSON Request RootUNWRAP_JSON_REQUEST NonNo Contenu JSON, POST, PUT, PATCHJSON content, POST, PUT, PATCH Envoie le Document sans la clé de son élément racine : {"name":…} au lieu de {"client":{"name":…}}.Sends the Document without the key of its root element: {"name":…} instead of {"client":{"name":…}}.
Retour à la ligne auto. pour la réponse JSONWrap JSON ResponseWRAP_JSON_RESPONSE OuiYes Type accepté JSONJSON accept type Place la réponse JSON sous un élément <root>, ce qui permet de lire un JSON à plusieurs clés racines. Le libellé français est une traduction fautive de Wrap : il s'agit d'envelopper la réponse.Puts the JSON response under a <root> element, which allows reading a JSON with several root keys.
Convertir les types en chaînes de caractèresConvert Types To StringsCONVERT_TYPES_TO_STRINGS NonNo Contenu ou type accepté JSON, ou « tous »JSON content or accept type, or "any" Écrit toutes les valeurs du JSON envoyé entre guillemets.Writes every value of the JSON sent between quotes.
En-têtes HTTPHTTP HeadersHEADERS videempty ToujoursAlways Table nom / valeur, deux expressions Java : "User-Agent", "MyJob/1.0".name / value table, two Java expressions: "User-Agent", "MyJob/1.0".
Service LocatorService LocatorSERVICE_LOCATOR_CUSTOM_PROPERTIES videempty Service Locator cochéService Locator checked Table nom / valeur : propriétés que le service recherché doit avoir.Name / value table: properties that the looked-up service must have.
Service Activity MonitorService Activity MonitorSERVICE_ACTIVITY_MONITOR_CUSTOM_PROPERTIES videempty Service Activity Monitor cochéService Activity Monitor checked Table nom / valeur, jointe aux événements envoyés au SAM.Name / value table, attached to the events sent to the SAM.
Désactiver l'encodage en blocsDisable chunked encodingDISABLE_CHUNKED_ENCODING NonNo POST, PUT, PATCHPOST, PUT, PATCH Envoie le corps avec un en-tête Content-Length au lieu de Transfer-Encoding: chunked, pour les serveurs qui refusent ce dernier.Sends the body with a Content-Length header instead of Transfer-Encoding: chunked, for the servers that refuse the latter.
Délai avant expiration de la connexion (en secondes)Connection timeout (seconds)CONNECTION_TIMEOUT 30 ToujoursAlways Temps laissé pour établir la connexion. Hors du Talend Runtime seulement.Time allowed to open the connection. Outside the Talend Runtime only.
Délai avant expiration de la réception (secondes)Receive timeout (seconds)RECEIVE_TIMEOUT 60 ToujoursAlways Temps laissé pour recevoir la réponse. Hors du Talend Runtime seulement.Time allowed to receive the response. Outside the Talend Runtime only.
Utiliser un proxy HTTPUse HTTP proxyUSE_PROXY NonNo ToujoursAlways Passe par un proxy. Hors du Talend Runtime seulement.Goes through a proxy. Outside the Talend Runtime only.
Hôte / Port / Utilisateur / Mot de passeHost / Port / Username / PasswordPROXY_HOST, PROXY_PORT, PROXY_USERNAME, PROXY_PASSWORD "127.0.0.1", 8080, "", "" Proxy cochéProxy checked Adresse du proxy et, s'il en demande, son utilisateur et son mot de passe.Address of the proxy and, if it asks for them, its user and its password.
Transférer ces éléments JSON en tant que tableauxTransfer these JSON elements as arraysARRAY_KEYS "" Contenu JSON, POST, PUT, PATCHJSON content, POST, PUT, PATCH Noms des éléments du Document à envoyer toujours comme des tableaux JSON, séparés par des espaces : "order line".Names of the elements of the Document to always send as JSON arrays, separated by spaces: "order line".

Les schémasThe schemas

Trois schémas fixes : celui de l'entrée et ceux des deux liens de sortie.Three fixed schemas: the one of the input and those of the two output links.

LienLinkColonneColumnTypeDescription
EntréeInputbodyDocumentCorps de la requête : envoyé en XML, ou converti en JSON avec le type de contenu JSON. Prioritaire sur string.Body of the request: sent as XML, or converted to JSON with the JSON content type. Takes precedence over string.
EntréeInputstringStringCorps de la requête, envoyé tel quel, quand body est nul ou absent.Body of the request, sent as it is, when body is null or missing.
ResponsestatusCodeIntegerCode de la réponse, inférieur à 300.Code of the response, below 300.
ResponsebodyDocumentLa réponse, pour les types acceptés XML et JSON avec Convertir la réponse en document DOM. Nul sinon, ou si la réponse n'a pas de corps.The response, for the XML and JSON accept types with Convert Response To DOM Document. Null otherwise, or if the response has no body.
ResponsestringStringLa réponse en texte, pour le type accepté tous ou sans conversion. Chaîne vide sinon.The response as text, for the any accept type or without conversion. An empty string otherwise.
ErreurErrorerrorCodeIntegerCode de la réponse en erreur, 300 ou plus.Code of the error response, 300 or above.
ErreurErrorerrorMessageStringCorps de la réponse en erreur, en texte ; s'il est vide, le message de l'erreur (HTTP 405 Method Not Allowed).Body of the error response, as text; if it is empty, the message of the error (HTTP 405 Method Not Allowed).

Le flux d'entrée peut avoir d'autres colonnes (id, name…) : le composant ne lit que body et string, mais ses paramètres peuvent utiliser les autres. Elles ne sont pas recopiées en sortie.The input flow may have other columns (id, name…): the component only reads body and string, but its settings can use the others. They are not copied to the output.

Réponses en erreurError responses

Ce que devient une erreur dépend du lien Erreur et de la case Arrêter en cas d'erreur. Codes de sortie relevés à l'exécution.What happens to an error depends on the Error link and on the Die on error box. Exit codes read from runs.

Réponse 300 et plus (404, 500…)Response 300 and above (404, 500…)Service injoignable, délai dépasséUnreachable service, timeout
Lien Erreur tracéError link drawnUne ligne sur le lien Erreur ; le job continue et se termine avec le code 0.One row on the Error link; the job goes on and ends with code 0.Comme sans lien Erreur : ce lien ne reçoit que les réponses HTTP.As without an Error link: this link only receives HTTP responses.
Sans lien, Arrêter en cas d'erreur cochéeNo link, Die on error checkedException, le job s'arrête avec le code 1.Exception, the job stops with code 1.Exception, le job s'arrête avec le code 1.Exception, the job stops with code 1.
Sans lien, case décochéeNo link, box uncheckedLa pile d'appels est écrite sur la sortie d'erreur, le job continue, mais se termine quand même avec le code 1.The stack trace is written to the error output, the job goes on, but still ends with code 1.De même.The same.

Une réponse 304 à un GET n'est pas une erreur. Dans tous les cas d'erreur, le message est dans globalMap sous tRESTClient_1_ERROR_MESSAGE.A 304 response to a GET is not an error. In every error case, the message is in globalMap under tRESTClient_1_ERROR_MESSAGE.

ExemplesExamples

Sorties copiées de l'exécution de jobs en local, pendant qu'un autre job publiait le service appelé (endpoint "http://localhost:8088/clients", décrit sur la page du tRESTRequest).Outputs copied from local runs of jobs, while another job published the called service (endpoint "http://localhost:8088/clients", described on the page of the tRESTRequest).

GET, réponse XMLGET, XML response

row1 (Response)OnSubjobOktRESTClient_1tLogRow_1tJava_1

URL "http://localhost:8088/clients", Chemin relatif "/2", le reste par défaut. Le tLogRow affiche statusCode|body|string ; le tJava, les variables du composant.URL "http://localhost:8088/clients", Relative Path "/2", the rest by default. The tLogRow displays statusCode|body|string; the tJava, the variables of the component.

200|<?xml version="1.0" encoding="UTF-8"?>
<client id="2"><name>Grace Petit</name><city>Lyon</city></client>|
NB_LINE=1, ERROR_MESSAGE=null
HEADERS={content-type=[application/xml], date=[Wed, 18 Nov 2026 17:49:44 GMT], server=[Jetty(12.0.15)], transfer-encoding=[chunked], Content-Type=[application/xml]}

GET, réponse JSONGET, JSON response

Le même appel avec Accepter type JSON. Le service répond {"client":{"id":2,"name":"Grace Petit","city":"Lyon"}}, que le composant convertit en Document, sous <root> :The same call with Accept Type JSON. The service answers {"client":{"id":2,"name":"Grace Petit","city":"Lyon"}}, which the component converts to a Document, under <root>:

200|<?xml version="1.0" encoding="UTF-8"?>
<root><client><id>2</id><name>Grace Petit</name><city>Lyon</city></client></root>|

Wrap JSON Response décochée :Wrap JSON Response unchecked:

200|<?xml version="1.0" encoding="UTF-8"?>
<client><id>2</id><name>Grace Petit</name><city>Lyon</city></client>|

Convertir la réponse en document DOM décochée : le JSON reçu, dans string.Convert Response To DOM Document unchecked: the JSON received, in string.

200||{"client":{"id":2,"name":"Grace Petit","city":"Lyon"}}

Type accepté « tous », paramètres et en-têtes"any" accept type, parameters and headers

Accepter type tous : le service choisit le type (ici XML) et la réponse arrive en texte, dans string.Accept Type any: the service chooses the type (XML here) and the response arrives as text, in string.

200||<?xml version="1.0" encoding="UTF-8"?>
<client id="2"><name>Grace Petit</name><city>Lyon</city></client>

Chemin vide, Paramètres de la requête "city" / "Paris", En-têtes HTTP "User-Agent" / "MyJob/1.0", type accepté JSON sans conversion :Empty path, Query parameters "city" / "Paris", HTTP Headers "User-Agent" / "MyJob/1.0", JSON accept type without conversion:

200||{"clients":{"client":[{"id":1,"name":"Ada Martin","city":"Paris"},{"id":3,"name":"Linus Morel","city":"Paris"}]}}

Le service appelé, qui affiche ce qu'il reçoit, a écrit dans sa console :The called service, which prints what it receives, wrote in its console:

listClients: city=Paris, limit=10, agent=MyJob/1.0

POST, un Document par lignePOST, one Document per row

row1 (Main)row2 (Main)row3 (Response)tFixedFlowInput_1tJavaRow_1tRESTClient_1tLogRow_1

Le tFixedFlowInput produit deux lignes (name, city) ; le tJavaRow en fait le Document de la colonne body :The tFixedFlowInput produces two rows (name, city); the tJavaRow turns them into the Document of the body column:

output_row.body = ParserUtils.parseTo_Document("<client><name>" + input_row.name + "</name><city>" + input_row.city + "</city></client>");

Méthode HTTP POST, type de contenu et type accepté XML. Deux appels, deux réponses 201 :HTTP Method POST, XML content type and accept type. Two calls, two 201 responses:

201|<?xml version="1.0" encoding="UTF-8"?>
<client><id>4</id><name>Marie Blanc</name><city>Nantes</city></client>|
201|<?xml version="1.0" encoding="UTF-8"?>
<client><id>4</id><name>Paul Roux</name><city>Lille</city></client>|
NB_LINE=1, ERROR_MESSAGE=null
HEADERS={content-type=[application/xml], date=[Wed, 18 Nov 2026 17:50:40 GMT], location=[http://localhost:8088/clients/4], server=[Jetty(12.0.15)], transfer-encoding=[chunked], Content-Type=[application/xml]}

Avec le type de contenu et le type accepté JSON (une ligne), le service reçoit {"client":{"name":"Marie Blanc","city":"Nantes"}} et la réponse revient sous <root> :With the JSON content type and accept type (one row), the service receives {"client":{"name":"Marie Blanc","city":"Nantes"}} and the response comes back under <root>:

201|<?xml version="1.0" encoding="UTF-8"?>
<root><client><id>4</id><name>Marie Blanc</name><city>Nantes</city></client></root>|

Le corps peut aussi être une chaîne : le tJavaRow écrit le JSON dans une colonne string. Sans conversion de la réponse :The body can also be a string: the tJavaRow writes the JSON to a string column. Without conversion of the response:

201||{"client":{"id":4,"name":"Marie Blanc","city":"Nantes"}}

Un appel par ligne, avec le lien ErreurOne call per row, with the Error link

row1 (Main)row2 (Response)row3 (Error)tFixedFlowInput_1tRESTClient_1tLogRow_1tLogRow_2

Quatre lignes, id = 99, 1, 98, 2 ; Chemin relatif "/" + row1.id. Les clients 99 et 98 n'existent pas : le service répond 404 avec un document d'erreur, qui arrive en texte dans errorMessage.Four rows, id = 99, 1, 98, 2; Relative Path "/" + row1.id. Clients 99 and 98 do not exist: the service answers 404 with an error document, which arrives as text in errorMessage.

[tLogRow_2] 404|<?xml version="1.0" encoding="UTF-8"?>
<error><message>Unknown client 99</message></error>
[tLogRow_1] 200|<?xml version="1.0" encoding="UTF-8"?>
<client id="1"><name>Ada Martin</name><city>Paris</city></client>|
[tLogRow_2] 404|<?xml version="1.0" encoding="UTF-8"?>
<error><message>Unknown client 98</message></error>
[tLogRow_1] 200|<?xml version="1.0" encoding="UTF-8"?>
<client id="2"><name>Grace Petit</name><city>Lyon</city></client>|
NB_LINE=1, ERROR_MESSAGE=HTTP 404 Not Found
HEADERS={content-type=[application/xml], date=[Wed, 18 Nov 2026 17:55:27 GMT], server=[Jetty(12.0.15)], transfer-encoding=[chunked], Content-Type=[application/xml]}

Le job se termine avec le code 0. ERROR_MESSAGE garde le message de la dernière erreur, même si l'appel suivant réussit. D'autres réponses en erreur du même service, sur le lien Erreur (errorCode|errorMessage) : une exception dans le job appelé, un verbe sans route, un type de contenu refusé.The job ends with code 0. ERROR_MESSAGE keeps the message of the last error, even if the next call succeeds. Other error responses of the same service, on the Error link (errorCode|errorMessage): an exception in the called job, a verb without a route, a refused content type.

[tLogRow_2] 500|Database unavailable
[tLogRow_2] 405|HTTP 405 Method Not Allowed
[tLogRow_2] 415|HTTP 415 Unsupported Media Type

404 sans lien Erreur404 without an Error link

Chemin relatif "/99", lien Response seul, Arrêter en cas d'erreur cochée (nom du job remplacé par MyJob, pile abrégée) :Relative Path "/99", Response link only, Die on error checked (job name replaced with MyJob, shortened stack):

Exception in component tRESTClient_1 (MyJob)
jakarta.ws.rs.NotFoundException: HTTP 404 Not Found
	at demo.myjob_0_1.MyJob.tRESTClient_1Process(MyJob.java:1010)
	at demo.myjob_0_1.MyJob.runJobInTOS(MyJob.java:1882)
	at demo.myjob_0_1.MyJob.main(MyJob.java:1674)
	…

Le job s'arrête avec le code 1. Case décochée, la même pile est écrite, puis le sous-job suivant s'exécute :The job stops with code 1. With the box unchecked, the same stack is written, then the next subjob runs:

NB_LINE=1, ERROR_MESSAGE=HTTP 404 Not Found
HEADERS=null

Le corps de la réponse en erreur est perdu, et le job se termine quand même avec le code 1.The body of the error response is lost, and the job still ends with code 1.

Service injoignableUnreachable service

Le même appel quand rien n'écoute sur le port, liens Response et Erreur tracés, Arrêter en cas d'erreur cochée :The same call when nothing listens on the port, Response and Error links drawn, Die on error checked:

Exception in component tRESTClient_1 (MyJob)
jakarta.ws.rs.ProcessingException: java.net.ConnectException: ConnectException invoking http://localhost:8088/clients/2: Connection refused
	at demo.myjob_0_1.MyJob.tRESTClient_1Process(MyJob.java:1390)
	…
Caused by: java.net.ConnectException: ConnectException invoking http://localhost:8088/clients/2: Connection refused
	…

Le lien Erreur ne reçoit rien : le job s'arrête avec le code 1. Case décochée, le job continue, avec :The Error link receives nothing: the job stops with code 1. With the box unchecked, the job goes on, with:

NB_LINE=1, ERROR_MESSAGE=java.net.ConnectException: ConnectException invoking http://localhost:8088/clients/2: Connection refused
HEADERS=null

Variables globalesGlobal variables

VariableVariableTypeDescription
HEADERSMap<String, List<String>>En-têtes de la dernière réponse. Remplie pour une réponse normale si le lien Response est tracé, pour une réponse en erreur si le lien Erreur l'est ; nulle sinon. Le même en-tête peut y figurer sous deux casses (content-type et Content-Type).Headers of the last response. Filled for a normal response if the Response link is drawn, for an error response if the Error link is; null otherwise. The same header may appear there under two cases (content-type and Content-Type).
CORRELATION_IDStringIdentifiant de corrélation de la réponse, avec Utiliser la Corrélation Métier.Correlation identifier of the response, with Use Business Correlation.
NB_LINEIntegerToujours 1 à la fin du composant, quel que soit le nombre d'appels : le modèle ne compte pas les lignes.Always 1 at the end of the component, whatever the number of calls: the template does not count the rows.
ERROR_MESSAGEStringMessage de la dernière erreur. Non déclarée par le composant (absente de la complétion), mais posée par le modèle.Message of the last error. Not declared by the component (missing from the completion), but set by the template.
COOKIESMap<String, NewCookie>Cookies de la dernière réponse. Non déclarée elle non plus ; posée dans les mêmes cas que HEADERS.Cookies of the last response. Not declared either; set in the same cases as HEADERS.
((java.util.Map<String, java.util.List<String>>) globalMap.get("tRESTClient_1_HEADERS")).get("location").get(0)
((String) globalMap.get("tRESTClient_1_ERROR_MESSAGE"))

Dans le Talend RuntimeIn the Talend Runtime

Lu dans le modèle du composant, sans essai dans un conteneur.Read in the template of the component, with no run in a container.

Studio, Talaxie, script du jobStudio, Talaxie, job scriptTalend Runtime (Karaf)Talend Runtime (Karaf)
Délais et proxyTimeouts and proxyCeux du composant.Those of the component.Ignorés : le modèle ne les applique que hors du conteneur. Ils se règlent dans la configuration du Runtime.Ignored: the template only applies them outside the container. They are set in the configuration of the Runtime.
Jeton SAMLSAML TokenRefusé : SAML based security scenarios are not supported in Studio (standalone).Rejected: SAML based security scenarios are not supported in Studio (standalone).Jeton demandé au service de jetons (STS) du conteneur avec l'utilisateur et le mot de passe.Token requested from the token service (STS) of the container with the user and the password.
Service LocatorService LocatorClient embarqué dans le job, configuré par ses fichiers META-INF/tesb : il faut un Service Locator joignable.Client embedded in the job, configured by its META-INF/tesb files: a reachable Service Locator is needed.Fonction du conteneur. L'adresse appelée est locator://rest, résolue par le nom du service.Feature of the container. The called address is locator://rest, resolved by the name of the service.
Service Activity MonitorService Activity MonitorAgent embarqué dans le job.Agent embedded in the job.Agent du conteneur.Agent of the container.
Basic, Digest, OAuth2 BearerBasic, Digest, OAuth2 BearerAppliqués par le composant.Applied by the component.De même.The same.

PiègesPitfalls

« shutdownNow » au deuxième appel"shutdownNow" on the second call

Le job de l'exemple « Un appel par ligne », avec les lignes 1, 99, 3. Le premier appel réussit, le deuxième échoue avant même d'atteindre le service, deux exécutions sur deux (nom du job remplacé par MyJob, pile abrégée) :The job of the "One call per row" example, with rows 1, 99, 3. The first call succeeds, the second one fails before even reaching the service, two runs out of two (job name replaced with MyJob, shortened stack):

[tLogRow_1] 200|<?xml version="1.0" encoding="UTF-8"?>
<client id="1"><name>Ada Martin</name><city>Paris</city></client>|
Exception in component tRESTClient_1 (MyJob)
jakarta.ws.rs.ProcessingException: java.io.IOException: IOException invoking http://localhost:8088/clients/99: shutdownNow
	at org.apache.cxf.jaxrs.client.AbstractClient.checkClientException(AbstractClient.java:645)
	…
	at demo.myjob_0_1.MyJob.tFixedFlowInput_1Process(MyJob.java:1714)
	…
Caused by: java.io.IOException: shutdownNow
	at java.net.http/jdk.internal.net.http.HttpClientImpl.shutdownNow(HttpClientImpl.java:625)
	at java.net.http/jdk.internal.net.http.HttpClientFacade.shutdownNow(HttpClientFacade.java:182)
	at org.apache.cxf.transport.http.HttpClientHTTPConduit$RefCount.lambda$release$0(HttpClientHTTPConduit.java:146)
	…
	at org.apache.cxf.jaxrs.client.AbstractClient.close(AbstractClient.java:367)
	at org.apache.cxf.jaxrs.client.AbstractClient.finalize(AbstractClient.java:342)
	…
	at java.base/java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:174)

Le composant crée un client HTTP par ligne. Quand Java libère le client de la ligne précédente, CXF (4.1.0, Java 21) ferme la connexion HTTP qu'il partage avec le client en cours : l'appel en cours échoue. Le moment dépend du ramasse-miettes, donc l'erreur est irrégulière : les mêmes appels dans un autre ordre (99, 1, 98, 2) ou trois appels réussis de suite sont passés. Ce n'est pas une réponse HTTP : le lien Erreur ne la reçoit pas.The component creates one HTTP client per row. When Java frees the client of the previous row, CXF (4.1.0, Java 21) closes the HTTP connection it shares with the current client: the current call fails. The moment depends on the garbage collector, so the error is irregular: the same calls in another order (99, 1, 98, 2) or three successful calls in a row went through. It is not an HTTP response: the Error link does not receive it.

Parade : cochez Réutiliser la connexion SSL, même en HTTP simple. Le client est alors gardé d'une ligne à l'autre ; le même job, case cochée, donne :Workaround: check Re-use SSL connection, even in plain HTTP. The client is then kept from one row to the next; the same job, with the box checked, gives:

[tLogRow_1] 200|<?xml version="1.0" encoding="UTF-8"?>
<client id="1"><name>Ada Martin</name><city>Paris</city></client>|
[tLogRow_2] 404|<?xml version="1.0" encoding="UTF-8"?>
<error><message>Unknown client 99</message></error>
[tLogRow_1] 200|<?xml version="1.0" encoding="UTF-8"?>
<client id="3"><name>Linus Morel</name><city>Paris</city></client>|

Code 1 même sans arrêtCode 1 even without stopping

Arrêter en cas d'erreur décochée et sans lien Erreur, le job va au bout mais sort avec le code 1 : un ordonnanceur le verra en échec. Pour qu'une réponse 404 ou 500 soit un cas normal, tracez le lien Erreur.With Die on error unchecked and no Error link, the job runs to the end but exits with code 1: a scheduler will see it as failed. For a 404 or 500 response to be a normal case, draw the Error link.

Le lien Erreur ne voit pas les pannesThe Error link does not see failures

Connexion refusée, délai dépassé, certificat refusé : ce ne sont pas des réponses HTTP, le lien Erreur ne reçoit rien et le job s'arrête ou continue selon Arrêter en cas d'erreur. Prévoyez un On Component Error ou un tLogCatcher pour ces cas.Connection refused, timeout, rejected certificate: these are not HTTP responses, the Error link receives nothing and the job stops or goes on depending on Die on error. Plan an On Component Error or a tLogCatcher for these cases.

NB_LINE vaut toujours 1NB_LINE is always 1

Après deux, trois ou quatre appels, NB_LINE valait 1 dans tous nos essais. Pour compter les appels, comptez les lignes des liens Response et Erreur.After two, three or four calls, NB_LINE was 1 in all our runs. To count the calls, count the rows of the Response and Error links.

Retirer la racine : le service doit suivreDrop the root: the service must follow

Avec Retirer la racine de la requête JSON, le corps part sans clé racine. Envoyé à un service publié par un tRESTRequest aux réglages par défaut, le document reçu n'avait plus que <name>Marie Blanc</name> et la réponse contenait des champs vides, avec un code 201. Côté service, il faut alors cocher Wrap JSON Request.With Drop JSON Request Root, the body leaves without a root key. Sent to a service published by a tRESTRequest with default settings, the received document only had <name>Marie Blanc</name> left and the response held empty fields, with a 201 code. On the service side, Wrap JSON Request must then be checked.

JSON vers XML : des noms d'éléments validesJSON to XML: valid element names

La conversion en Document suppose que les clés du JSON peuvent être des noms d'éléments XML, et un tableau à la racine n'a pas d'équivalent direct. Pour un JSON quelconque, décochez Convertir la réponse en document DOM et lisez la colonne string avec un tExtractJSONFields.The conversion to a Document assumes that the JSON keys can be XML element names, and an array at the root has no direct equivalent. For arbitrary JSON, uncheck Convert Response To DOM Document and read the string column with a tExtractJSONFields.

Une réponse sans corpsA response without a body

Une réponse 202 sans contenu a donné la ligne 202|| : body nul, string vide. Testez body avant de le lire dans la suite du flux.A 202 response with no content gave the 202|| row: null body, empty string. Test body before reading it in the rest of the flow.

Voir aussiSee also