ComposantsComponents

ComposantsComponents › ESB › Web Services

tESBConsumer

tESBConsumer

ESB › Web Services

Appelle une opération d'un service web SOAP. Pour chaque ligne reçue, le document XML de la colonne payload part comme corps de la requête ; le corps de la réponse ressort sur le lien Response, lui aussi dans une colonne payload. Si le service répond une erreur SOAP, la ligne sort sur le lien Fault, avec le code, le texte et le détail de l'erreur. Le composant s'occupe de l'enveloppe SOAP et du transport HTTP ; le contenu des messages reste à la charge du job. Calls an operation of a SOAP web service. For each received row, the XML document of the payload column leaves as the body of the request; the body of the response comes out on the Response link, in a payload column as well. If the service answers a SOAP fault, the row comes out on the Fault link, with the code, the text and the detail of the fault. The component takes care of the SOAP envelope and of the HTTP transport; the content of the messages is left to the job.

EntréeInput

Un lien Main, obligatoire : une requête par ligne, colonne payload (Document). Sans lien entrant, le composant ne génère aucun code. One Main link, required: one request per row, payload column (Document). Without an incoming link, the component generates no code.

SortieOutput

Un lien Response et un lien Fault, facultatifs. Chaque ligne d'entrée sort sur l'un ou sur l'autre. One Response link and one Fault link, both optional. Each input row comes out on one or the other.

Déclencheurs en sortieOutput triggers

On Component Ok On Component Error Run if

UtilisationUsage

Interroger un service pour chaque ligneQuerying a service for each row

row1 (Main) row2 (Main) row3 (Response) row4 (Main) row5 (Fault) tFileInputDelimited_1 tXMLMap_1 tESBConsumer_1 tXMLMap_2 tLogRow_1 tFileOutputDelimited_1

Le premier tXMLMap construit le document de la requête à partir des colonnes du fichier ; le second lit le document de la réponse. Les erreurs du service vont dans un fichier de rejets. The first tXMLMap builds the document of the request from the columns of the file; the second one reads the document of the response. The faults of the service go to a reject file.

Un service qui en appelle un autreA service that calls another one

row1 (Main) row2 (Main) row3 (Response) row4 (Main) tESBProviderRequest_1 tXMLMap_1 tESBConsumer_1 tXMLMap_2 tESBProviderResponse_1

Dans un job qui sert lui-même une opération, le tESBConsumer peut reprendre des en-têtes HTTP de la requête reçue (colonne Propager du tableau En-têtes HTTP). In a job that itself serves an operation, the tESBConsumer can take over HTTP headers of the received request (propagate column of the HTTP Headers table).

  1. Déposez le tESBConsumer depuis la famille ESB › Web Services et ouvrez sa Configuration de service : indiquez le WSDL, puis choisissez le port et l'opération. Drop the tESBConsumer from the ESB › Web Services family and open its Service configuration: give the WSDL, then choose the port and the operation.
  2. Vérifiez l'Endpoint : c'est l'adresse réellement appelée, une expression Java ("http://localhost:8090/services/Clients" ou une variable de contexte). Check the Endpoint: it is the address actually called, a Java expression ("http://localhost:8090/services/Clients" or a context variable).
  3. Reliez en entrée un composant qui produit le document de la requête dans une colonne payload : sa racine est l'élément attendu par l'opération, avec son espace de noms. Connect as input a component that produces the document of the request in a payload column: its root is the element expected by the operation, with its namespace.
  4. Reliez les sorties par clic droit › Ligne › Response et Ligne › Fault. Connect the outputs with right-click › Row › Response and Row › Fault.

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. Le composant a aussi des paramètres réservés à l'édition avec Service Registry (Utiliser le Service Registry, Utiliser autorisation, Rôle, Chiffrement/Corps de signature) : Talaxie ne les affiche pas. Labels are those of the Component tab; the technical name, in grey, is the parameter name in the job file. The component also has parameters reserved for the edition with Service Registry (Use Service Registry, Use Authorization, Role, Encryption/Signature body): Talaxie does not display them.

ParamètreSetting DéfautDefault VisibleShown Description
Configuration de serviceService configurationSERVICE_CONFIGURATION — ToujoursAlways Bouton qui ouvre l'éditeur du service : il lit un WSDL et fait choisir le port et l'opération. Il remplit les paramètres cachés du composant : nom et espace de noms du service et du port, opération (METHOD), action SOAP, et style d'échange, request-response ou one-way. Button that opens the service editor: it reads a WSDL and lets you choose the port and the operation. It fills the hidden parameters of the component: name and namespace of the service and of the port, operation (METHOD), SOAP action, and exchange style, request-response or one-way.
EndpointESB_ENDPOINT "http://www.webservicex.net/globalweather.asmx" ToujoursAlways Adresse appelée, en Java. Elle remplace celle du WSDL. Le défaut désigne un service public d'exemple : remplacez-le. Called address, in Java. It replaces the one of the WSDL. The default points to a public sample service: replace it.
Schéma d'entrée, Schéma Response, Schéma FaultInput Schema, Response Schema, Fault SchemaINPUT_SCHEMA, SCHEMA_RESPONSE, SCHEMA_FAULT fixesfixed ToujoursAlways Trois schémas en lecture seule : voir Les schémas. Three read-only schemas: see The schemas.
Utiliser le Service LocatorUse Service LocatorSERVICE_LOCATOR NonNo ToujoursAlways L'adresse n'est plus l'Endpoint : elle est demandée au Service Locator, d'après le nom du service. Il faut un Service Locator en fonctionnement. The address is no longer the Endpoint: it is asked from the Service Locator, by the name of the service. A running Service Locator is needed.
Utiliser Service Activity MonitorUse Service Activity MonitorSERVICE_ACTIVITY_MONITOR NonNo ToujoursAlways Envoie un événement par message au Service Activity Monitoring. Il faut un serveur SAM en fonctionnement. Sends one event per message to Service Activity Monitoring. A running SAM server is needed.
Utiliser l'authentificationUse AuthenticationNEED_AUTH NonNo ToujoursAlways Affiche le type d'authentification et les identifiants. Shows the authentication type and the credentials.
Type d'authentificationAuthentication TypeAUTH_TYPE Jeton SAML (ESB Runtime uniquement)SAML Token (ESB runtime only) Si Utiliser l'authentificationIf Use Authentication Basic HTTP et HTTP Digest : identifiants dans les en-têtes HTTP. Jeton de nom d'utilisateur : en-tête SOAP WS-Security, mot de passe en clair. Jeton SAML : jeton demandé à un serveur STS, dans le Talend Runtime seulement ; une liste voisine propose alors de propager le jeton de la requête reçue, par nom d'utilisateur et mot de passe ou par certificat (Alias). Basic HTTP and HTTP Digest: credentials in the HTTP headers. Username Token: WS-Security SOAP header, password in clear text. SAML Token: token asked from an STS server, in the Talend Runtime only; a nearby list then offers to propagate the token of the received request, by username and password or by certificate (Alias).
Utilisateur, Mot de passeUsername, PasswordAUTH_USERNAME, AUTH_PASSWORD "username", "password" Si Utiliser l'authentificationIf Use Authentication Identifiants, en Java. Avec la propagation par certificat, Utilisateur est remplacé par Alias (AUTH_ALIAS, défaut "alias"). Credentials, in Java. With propagation by certificate, Username is replaced with Alias (AUTH_ALIAS, default "alias").
Utiliser la Corrélation MétierUse Business CorrelationUSE_BUSINESS_CORRELATION NonNo ToujoursAlways Joint un identifiant de corrélation à la requête, la Valeur de corrélation (CORRELATION_VALUE, en Java, affichée alors). Il est ensuite lu dans la variable CORRELATION_ID. Attaches a correlation identifier to the request, the Correlation Value (CORRELATION_VALUE, in Java, then displayed). It is then read from the CORRELATION_ID variable.
Utiliser la compression GZipUse GZip CompressionENABLE_CXF_MESSAGE_GZIP NonNo ToujoursAlways Annonce au service que la réponse peut être compressée (en-tête Accept-Encoding). Tells the service that the response may be compressed (Accept-Encoding header).
Arrêter en cas d'erreurDie on errorDIE_ON_ERROR OuiYes ToujoursAlways Concerne les échecs de l'appel lui-même : service injoignable, délai dépassé, réponse illisible. Cochée, le job s'arrête ; décochée, l'erreur est écrite et le job passe à la ligne suivante. Une erreur SOAP répondue par le service n'est pas concernée : elle sort sur le lien Fault. Applies to the failures of the call itself: unreachable service, timeout, unreadable response. Checked, the job stops; unchecked, the error is written and the job goes on to the next row. A SOAP fault answered by the service is not concerned: it comes out on the Fault link.

Paramètres avancésAdvanced settings

ParamètreSetting DéfautDefault VisibleShown Description
Messages de logLog messagesLOG_MESSAGES NonNo ToujoursAlways Ajoute la journalisation des messages de CXF (requêtes et réponses SOAP), qui masque l'en-tête Authorization et les éléments password. Les messages passent par le journal du job (log4j). Lancé depuis Talaxie sans configuration de journal, le job n'en a rien affiché dans la console lors de nos essais. Adds the CXF message logging (SOAP requests and responses), which masks the Authorization header and the password elements. The messages go through the log of the job (log4j). 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 redirections HTTP, vers le même hôte seulement, sauf si Autoriser les redirections vers des hôtes différents (REDIRECT_NON_SAME_HOST, affichée alors) est cochée. Follows HTTP redirects, to the same host only, unless Allow non-same host redirects (REDIRECT_NON_SAME_HOST, then displayed) is checked.
Propriétés personnalisées du Service LocatorService Locator Custom PropertiesSERVICE_LOCATOR_CUSTOM_PROPERTIES videempty Si Utiliser le Service LocatorIf Use Service Locator Couples nom et valeur, en Java, qui restreignent le choix du Service Locator aux points d'accès enregistrés avec ces propriétés. Name and value pairs, in Java, that restrict the choice of the Service Locator to the endpoints registered with these properties.
Propriétés personnalisées de l'activité de serviceService Activity Custom PropertiesSERVICE_ACTIVITY_CUSTOM_PROPERTIES videempty Si Utiliser Service Activity MonitorIf Use Service Activity Monitor Couples nom et valeur, en Java, joints aux événements envoyés au Service Activity Monitoring. Name and value pairs, in Java, attached to the events sent to Service Activity Monitoring.
Délai avant expiration de la connexion (secondes)Connection Time out(second)CONNECTION_TIMEOUT 30 ToujoursAlways Temps laissé à l'ouverture de la connexion. Le formulaire le précise : Studio Only. Dans le Talend Runtime, les délais se règlent dans la configuration du conteneur. Time given to open the connection. The form says it: Studio Only. In the Talend Runtime, timeouts are set in the configuration of the container.
Délai avant réponse du serveur (en secondes)Receive Time out(second)RECEIVE_TIMEOUT 60 ToujoursAlways Temps d'attente de la réponse, Studio Only lui aussi. Time spent waiting for the response, Studio Only as well.
Désactiver la mise en blocsDisable ChunkingDISABLE_CHUNKING NonNo Si Suivre les redirections est décochéeIf Follow redirects is unchecked Envoie la requête en une fois, avec sa longueur, pour les serveurs et les proxys qui refusent l'envoi par blocs. Sends the request in one piece, with its length, for the servers and proxies that refuse chunked transfer.
Serveur sécurisé avec SSL (utilisez le tSetKeystore plutôt que cette option)Trust server with SSL (Use tSetKeystore rather than this option)NEED_SSL_TO_TRUSTSERVER NonNo ToujoursAlways Affiche Fichier TrustStore (SSL_TRUSTSERVER_TRUSTSTORE, défaut "C:/clientTrustStore.trustStore") et Mot de passe du TrustStore. Ils deviennent les propriétés javax.net.ssl.trustStore de la machine virtuelle : tout le job est concerné, pas seulement ce composant. Shows TrustStore file (SSL_TRUSTSERVER_TRUSTSTORE, default "C:/clientTrustStore.trustStore") and TrustStore password. They become the javax.net.ssl.trustStore properties of the virtual machine: the whole job is concerned, not only this component.
Utiliser un proxy httpUse http proxyUSE_PROXY NonNo ToujoursAlways Affiche Hôte du proxy ("127.0.0.1"), Port du proxy (8080), Utilisateur(trice) du proxy et Mot de passe du proxy. Shows Proxy host ("127.0.0.1"), Proxy port (8080), Proxy user and Proxy password.
En-têtes HTTPHTTP HeadersHEADERS videempty ToujoursAlways En-têtes ajoutés à la requête : nom et valeur, en Java. Avec Propager cochée, la valeur est ignorée : l'en-tête du même nom est repris de la requête reçue par le tESBProviderRequest du job, s'il y en a un. Headers added to the request: name and value, in Java. With propagate checked, the value is ignored: the header with the same name is taken from the request received by the tESBProviderRequest of the job, if there is one.

Les schémasThe schemas

Trois schémas fixes. Les valeurs de la dernière colonne ont été relevées à l'exécution, sur un service SOAP 1.1. Three fixed schemas. The values of the last column were read from runs, on a SOAP 1.1 service.

LienLink ColonneColumn Type ContenuContent
EntréeInput payload Document Corps de la requête : l'élément attendu par l'opération. Le composant l'enveloppe dans soap:Envelope et soap:Body.Body of the request: the element expected by the operation. The component wraps it in soap:Envelope and soap:Body.
Response payload Document Corps de la réponse, sans l'enveloppe. null pour une opération sans réponse.Body of the response, without the envelope. null for an operation without a response.
Fault faultCode String (1024) Code de l'erreur, espace de noms entre accolades : {http://schemas.xmlsoap.org/soap/envelope/}Server.Code of the fault, namespace in braces: {http://schemas.xmlsoap.org/soap/envelope/}Server.
faultString String (1024) Texte de l'erreur.Text of the fault.
faultActor String (1024) null lors de nos essais.null in our runs.
faultNode
faultRole
String (1024) Nœud et rôle d'une erreur SOAP 1.2 ; null en SOAP 1.1.Node and role of a SOAP 1.2 fault; null in SOAP 1.1.
faultDetail Document Premier élément du détail de l'erreur ; null si l'erreur n'a pas de détail.First element of the detail of the fault; null if the fault has no detail.

Variables globalesGlobal variables

  • tESBConsumer_1_HTTP_RESPONSE_CODE (Integer) · code HTTP du dernier appel : 200, 500 pour une erreur SOAP, 202 pour une opération sans réponse, 0 si le service n'a pas répondu.HTTP code of the last call: 200, 500 for a SOAP fault, 202 for an operation without a response, 0 if the service did not answer.
  • tESBConsumer_1_HTTP_HEADERS (Map<String, List<?>>) · en-têtes HTTP de la dernière réponse.HTTP headers of the last response.
  • tESBConsumer_1_CORRELATION_ID (String) · identifiant de corrélation, avec Utiliser la Corrélation Métier.correlation identifier, with Use Business Correlation.

Les deux premières ne figurent pas dans la liste des variables proposées par le Studio : saisissez leur nom. À l'inverse, NB_LINE et HEADERS y figurent mais ne sont jamais renseignées : elles valent null. The first two are not in the list of variables offered by the Studio: type their name. Conversely, NB_LINE and HEADERS are in it but are never set: they are null.

Studio et RuntimeStudio and Runtime

  • À l'exécution du job (Studio, Talaxie, job autonome), le composant crée lui-même le client CXF : Endpoint, proxy, délais, authentification Basic, Digest ou par jeton de nom d'utilisateur sont ceux du formulaire. Le Jeton SAML n'y est pas appliqué.When the job runs (Studio, Talaxie, standalone job), the component itself creates the CXF client: Endpoint, proxy, timeouts, Basic, Digest or username token authentication are those of the form. The SAML Token is not applied there.
  • Dans le Talend Runtime, le job demande le client au conteneur, qui applique en plus le jeton SAML et sa propagation, le Service Locator (avec la stratégie de choix du point d'accès) et le Service Activity Monitoring avec sa propre configuration. Le proxy, les délais et le TrustStore du formulaire ne sont pas transmis au conteneur.In the Talend Runtime, the job asks the container for the client, which additionally applies the SAML token and its propagation, the Service Locator (with the endpoint selection strategy) and Service Activity Monitoring with its own configuration. The proxy, the timeouts and the TrustStore of the form are not passed to the container.

ExemplesExamples

Le service appelé est celui des pages tESBProviderRequest et tESBProviderFault : Clients, opération getClient, publié en local par un job à http://localhost:8090/services/Clients. Il connaît le client 1, répond l'erreur Client not found pour les autres, et lève une exception pour l'identifiant boom. Les deux jobs ont été exécutés dans Talaxie ; les consoles sont copiées telles quelles, le nom des jobs remplacé par MyClient et les piles d'appels abrégées (…). Le saut de ligne après chaque déclaration XML vient de l'affichage des documents par le tLogRow. The called service is the one of the tESBProviderRequest and tESBProviderFault pages: Clients, getClient operation, published locally by a job at http://localhost:8090/services/Clients. It knows client 1, answers the Client not found fault for the others, and throws an exception for the boom identifier. Both jobs were run in Talaxie; the consoles are copied as they are, the job names replaced with MyClient and the stack traces shortened (…). The line break after each XML declaration comes from the way the tLogRow prints documents.

Une réponse et une erreurA response and a fault

row1 (Main) row2 (Main) row3 (Response) row4 (Fault) OnSubjobOk tFixedFlowInput_1 tJavaRow_1 tESBConsumer_1 tLogRow_1 tLogRow_2 tJava_1

Le tFixedFlowInput donne deux identifiants, 1 puis 99. Le tJavaRow construit la requête ; les deux tLogRow sont en mode Vertical ; le tJava affiche les variables globales. Code du tJavaRow : The tFixedFlowInput gives two identifiers, 1 then 99. The tJavaRow builds the request; both tLogRow components are in Vertical mode; the tJava prints the global variables. Code of the tJavaRow:

org.dom4j.Document doc = org.dom4j.DocumentHelper.createDocument();
org.dom4j.Element root = doc.addElement("tns:getClientRequest", "http://www.talend.org/service/");
root.addElement("id").setText(input_row.id);
output_row.payload = new routines.system.Document();
output_row.payload.setDocument(doc);
.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
|                                                                                          #1. tLogRow_1                                                                                          |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key     | value                                                                                                                                                                                 |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| payload | <?xml version="1.0" encoding="UTF-8"?>
<tns:getClientResponse xmlns:tns="http://www.talend.org/service/"><id>1</id><name>Alice Martin</name><city>Lyon</city></tns:getClientResponse> |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

.---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
|                                                                                        #1. tLogRow_2                                                                                        |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key         | value                                                                                                                                                                         |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| faultCode   | {http://www.talend.org/service/}businessFault                                                                                                                                 |
| faultString | Client not found [tESBProviderFault_1]                                                                                                                                        |
| faultActor  | null                                                                                                                                                                          |
| faultNode   | null                                                                                                                                                                          |
| faultRole   | null                                                                                                                                                                          |
| faultDetail | <?xml version="1.0" encoding="UTF-8"?>
<tns:clientNotFound xmlns:tns="http://www.talend.org/service/"><id>99</id><reason>No client with this id</reason></tns:clientNotFound> |
+-------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

NB_LINE = null
HEADERS = null
CORRELATION_ID = null
HTTP_RESPONSE_CODE = 500
HTTP_HEADERS = {Content-Length=[433], content-type=[text/xml;charset=utf-8], date=[Wed, 18 Nov 2026 17:50:09 GMT], server=[Jetty(12.0.15)]}

La première ligne sort sur Response, la seconde sur Fault, et le job se termine avec le code 0 : une erreur SOAP reliée n'est pas un échec. Les variables décrivent le dernier appel, celui du client 99 : HTTP 500. The first row comes out on Response, the second on Fault, and the job ends with code 0: a connected SOAP fault is not a failure. The variables describe the last call, the one for client 99: HTTP 500.

Une exception du serviceAn exception of the service

Le même job, avec les identifiants boom puis 1. Le job du service lève une exception pour le premier : The same job, with the identifiers boom then 1. The job of the service throws an exception for the first one:

.-----------------------------------------------------------------.
|                          #1. tLogRow_2                          |
+-------------+---------------------------------------------------+
| key         | value                                             |
+-------------+---------------------------------------------------+
| faultCode   | {http://schemas.xmlsoap.org/soap/envelope/}Server |
| faultString | Clients database is unreachable                   |
| faultActor  | null                                              |
| faultNode   | null                                              |
| faultRole   | null                                              |
| faultDetail | null                                              |
+-------------+---------------------------------------------------+

.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
|                                                                                          #1. tLogRow_1                                                                                          |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key     | value                                                                                                                                                                                 |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| payload | <?xml version="1.0" encoding="UTF-8"?>
<tns:getClientResponse xmlns:tns="http://www.talend.org/service/"><id>1</id><name>Alice Martin</name><city>Lyon</city></tns:getClientResponse> |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

L'exception arrive elle aussi sur Fault, avec le code Server de SOAP, le message de l'exception et pas de détail. Le job continue avec la ligne suivante. The exception arrives on Fault as well, with the Server code of SOAP, the message of the exception and no detail. The job goes on with the next row.

Sans lien FaultWithout a Fault link

Le job du premier exemple sans le tLogRow_2, avec les identifiants 99 puis 1, Arrêter en cas d'erreur cochée : The job of the first example without tLogRow_2, with the identifiers 99 then 1, Die on error checked:

Fault {string: Client not found [tESBProviderFault_1]; code:{http://www.talend.org/service/}businessFault; detail:<?xml version="1.0" encoding="UTF-8"?>
<tns:clientNotFound xmlns:tns="http://www.talend.org/service/"><id>99</id><reason>No client with this id</reason></tns:clientNotFound>}
org.apache.cxf.binding.soap.SoapFault: Client not found [tESBProviderFault_1]
	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:87)
	…
.-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------.
|                                                                                          #1. tLogRow_1                                                                                          |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| key     | value                                                                                                                                                                                 |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| payload | <?xml version="1.0" encoding="UTF-8"?>
<tns:getClientResponse xmlns:tns="http://www.talend.org/service/"><id>1</id><name>Alice Martin</name><city>Lyon</city></tns:getClientResponse> |
+---------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

NB_LINE = null
HEADERS = null
CORRELATION_ID = null
HTTP_RESPONSE_CODE = 200
HTTP_HEADERS = {Content-Length=[251], content-type=[text/xml;charset=utf-8], date=[Wed, 18 Nov 2026 17:48:53 GMT], server=[Jetty(12.0.15)]}

L'erreur est écrite, une ligne Fault {…} sur la sortie standard puis la pile d'appels sur la sortie d'erreur, mais le job continue, traite le client 1 et se termine avec le code 0, que la case soit cochée ou non. Sans lien Fault, une erreur du service passe donc inaperçue pour la suite du job. The fault is written, one Fault {…} line on the standard output then the stack trace on the error output, but the job goes on, handles client 1 and ends with code 0, whether the box is checked or not. Without a Fault link, a fault of the service thus goes unnoticed by the rest of the job.

Service arrêté, Arrêter en cas d'erreurService stopped, Die on error

Le job du premier exemple, Endpoint sur un port où rien n'écoute, case cochée : The job of the first example, Endpoint on a port where nothing listens, box checked:

Exception in component tESBConsumer_1 (MyClient)
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientWrappedOutputStream.isConnectionAttemptCompleted(HttpClientHTTPConduit.java:932)
	…
Caused by: java.net.ConnectException
	at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Utils.java:1065)
	…
Caused by: java.nio.channels.ClosedChannelException
	at java.base/sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:202)
	…

Le job s'arrête à la première ligne, avec le code 1. Rien ne sort sur Fault : ce n'est pas une erreur SOAP. The job stops at the first row, with code 1. Nothing comes out on Fault: it is not a SOAP fault.

Service arrêté, case décochéeService stopped, box unchecked

Le même job, deux lignes en entrée, Arrêter en cas d'erreur décochée : The same job, two input rows, Die on error unchecked:

Exception in component tESBConsumer_1 (MyClient)
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientWrappedOutputStream.isConnectionAttemptCompleted(HttpClientHTTPConduit.java:932)
	…
Caused by: java.net.ConnectException
	at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Utils.java:1065)
	…
Caused by: java.nio.channels.ClosedChannelException
	at java.base/sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:202)
	…
Exception in component tESBConsumer_1 (MyClient)
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.transport.http.HttpClientHTTPConduit$HttpClientWrappedOutputStream.isConnectionAttemptCompleted(HttpClientHTTPConduit.java:932)
	…
Caused by: java.net.ConnectException
	at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Utils.java:1065)
	…
Caused by: java.nio.channels.ClosedChannelException
	at java.base/sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:202)
	…
NB_LINE = null
HEADERS = null
CORRELATION_ID = null
HTTP_RESPONSE_CODE = 0
HTTP_HEADERS = {}

Une erreur par ligne, puis la suite du job s'exécute (le tJava). Aucune ligne ne sort, ni sur Response ni sur Fault, et le job se termine quand même avec le code 1. One error per row, then the rest of the job runs (the tJava). No row comes out, neither on Response nor on Fault, and the job still ends with code 1.

Opération sans réponseOperation without a response

Appel de l'opération notifyClient, de style one-way, servie par un autre job. Une ligne en entrée : Call of the notifyClient operation, of one-way style, served by another job. One input row:

.-----------------.
|  #1. tLogRow_1  |
+---------+-------+
| key     | value |
+---------+-------+
| payload | null  |
+---------+-------+

NB_LINE = null
HEADERS = null
CORRELATION_ID = null
HTTP_RESPONSE_CODE = 202
HTTP_HEADERS = {}

Une ligne sort quand même sur Response, avec un payload à null : testez-le avant de lire le document. Le code HTTP est 202. A row still comes out on Response, with a null payload: test it before reading the document. The HTTP code is 202.

Authentification Basic et en-tête HTTPBasic authentication and HTTP header

Utiliser l'authentification, Basic HTTP, utilisateur "demo" ; une ligne dans En-têtes HTTP : "X-Request-Source", "billing". Le job du service affiche les en-têtes HTTP qu'il reçoit : Use Authentication, Basic HTTP, user "demo"; one row in HTTP Headers: "X-Request-Source", "billing". The job of the service prints the HTTP headers it receives:

web service [endpoint: http://localhost:8090/services/Clients] published
NB_LINE = null
CORRELATION_ID = null
SECURITY_TOKEN = null
HEADERS_SOAP = []
HEADERS_HTTP is a java.util.TreeMap
  Accept = [*/*]
  Authorization = [Basic ZGVtbzpkZW1vLXBhc3M=]
  Content-Length = [207]
  HTTP2-Settings = [AAEAAEAAAAIAAAAAAAMAAAAAAAQBAAAAAAUAAEAAAAYABgAA]
  Host = [localhost:8090]
  SOAPAction = ["http://www.talend.org/service/getClient"]
  Upgrade = [h2c]
  User-Agent = [Apache-CXF/4.1.0]
  X-Request-Source = [billing]
  connection = [Upgrade, HTTP2-Settings]
  content-type = [text/xml; charset=UTF-8]

Les identifiants partent dès la première requête, encodés en Base64 et non chiffrés : réservez Basic HTTP à une adresse en https. The credentials leave with the very first request, Base64-encoded and not encrypted: keep Basic HTTP for an https address.

PiègesPitfalls

Jeton de nom d'utilisateur et corrélation à l'exécution du jobUsername token and correlation when the job runs

Lors de nos essais (jobs lancés depuis Talaxie, avec les bibliothèques déclarées par le composant, CXF 4.1.0), deux options ont fait échouer le job avant tout appel, sur une classe absente. Jeton de nom d'utilisateur : In our runs (jobs started from Talaxie, with the libraries declared by the component, CXF 4.1.0), two options made the job fail before any call, on a missing class. Username Token:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/soap/SAAJMetaFactory
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
	…
Caused by: java.lang.ClassNotFoundException: javax.xml.soap.SAAJMetaFactory
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	…

Utiliser la Corrélation Métier : Use Business Correlation:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.talend.esb.policy.correlation.impl.CorrelationIDProcessor.process(CorrelationIDProcessor.java:33)
	at org.talend.esb.policy.correlation.impl.CorrelationIDFeatureOutInterceptor.handleMessage(CorrelationIDFeatureOutInterceptor.java:32)
	…
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	…

Ces erreurs ne sont pas des exceptions ordinaires : Arrêter en cas d'erreur n'y change rien. Basic HTTP, la compression GZip et les en-têtes HTTP ont fonctionné dans les mêmes conditions. Ces deux options n'ont pas été essayées dans le Talend Runtime. These errors are not ordinary exceptions: Die on error makes no difference. Basic HTTP, GZip compression and HTTP headers worked under the same conditions. These two options were not tried in the Talend Runtime.

Arrêter en cas d'erreur n'arrête pas sur une erreur SOAPDie on error does not stop on a SOAP fault

La case ne concerne que les échecs de l'appel. Pour arrêter le job quand le service répond une erreur, reliez Fault à un tDie. The box only applies to the failures of the call. To stop the job when the service answers a fault, connect Fault to a tDie.

Le document n'est pas vérifiéThe document is not checked

Le composant envoie le payload tel quel, sans le comparer au WSDL. Une racine mal nommée ou sans son espace de noms part quand même : c'est le service qui la refusera, ou la lira de travers. The component sends the payload as it is, without checking it against the WSDL. A misnamed root, or one without its namespace, leaves anyway: the service is the one that will refuse it, or misread it.

Les variables du dernier appelThe variables of the last call

HTTP_RESPONSE_CODE et HTTP_HEADERS sont réécrites à chaque ligne : lues après le sous-job, elles ne décrivent que le dernier appel. Et pour un appel sans réponse (HTTP 202), le modèle écrit le code dans tESBConsumer_1_HTTP_RESPONSE_CODE quel que soit le nom du composant : avec un tESBConsumer_2, lisez cette variable-là. HTTP_RESPONSE_CODE and HTTP_HEADERS are rewritten at each row: read after the subjob, they only describe the last call. And for a call without a response (HTTP 202), the template writes the code to tESBConsumer_1_HTTP_RESPONSE_CODE whatever the name of the component: with a tESBConsumer_2, read that variable.

Le type d'authentification par défautThe default authentication type

En cochant Utiliser l'authentification, le type proposé est Jeton SAML (ESB Runtime uniquement). À l'exécution du job, ce type n'ajoute rien à la requête : elle part sans identifiants. Choisissez le type que le service attend. When Use Authentication is checked, the offered type is SAML Token (ESB runtime only). When the job runs, this type adds nothing to the request: it leaves without credentials. Choose the type the service expects.

ConseilsTips

L'adresse dans le contexteThe address in the context

Mettez l'Endpoint dans une variable de contexte (context.clients_url) : le même job appelle le service de test puis celui de production sans être modifié. Put the Endpoint in a context variable (context.clients_url): the same job calls the test service then the production one without being changed.

Toujours relier FaultAlways connect Fault

Même vers un simple tLogRow ou un fichier : les erreurs du service deviennent des lignes, avec leur code et leur détail, au lieu d'une pile d'appels dans la console. Even to a plain tLogRow or a file: the faults of the service become rows, with their code and their detail, instead of a stack trace in the console.

Voir aussiSee also