ComposantsComponents

ComposantsComponents › Internet

tWebServiceInput

tWebServiceInput

Internet

Interroge un service web SOAP à partir de son WSDL et en lit le résultat : vous donnez le nom de l'opération et la valeur de chaque paramètre, le composant construit la requête et range la réponse dans les colonnes de son schéma, une ligne par appel. Deux clients au choix (Paramètres avancés › API) : Apache Axis 1.4 (défaut) ou Apache CXF 3.5.5, qui ne se comportent pas de la même façon. Les paramètres doivent être de type simple ; pour une requête structurée ou un appel par ligne d'un flux, prenez un tWebService.Requests a SOAP web service from its WSDL and reads its result: you give the name of the operation and the value of each parameter, the component builds the request and stores the response in the columns of its schema, one row per call. Two clients to choose from (Advanced settings › API): Apache Axis 1.4 (default) or Apache CXF 3.5.5, which do not behave the same way. The parameters must be of a simple type; for a structured request or one call per row of a flow, take a tWebService.

EntréeInput

Aucune : il commence le sous-job. Ou un lien Iterate : un appel par itération.None: it starts the subjob. Or an Iterate link: one call per iteration.

SortieOutput

Un lien Main : une ligne par appel, la réponse répartie dans les colonnes du schéma, dans l'ordre.One Main link: one row per call, the response spread over the columns of the schema, in order.

Déclencheurs en sortieOutput triggers

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

UtilisationUsage

row1 (Main)OnSubjobOktWebServiceInput_1tLogRow_1tJava_1

Un appel, une ligne. Pour plusieurs appels, faites-le précéder d'un lien Iterate (tFlowToIterate, tLoop) et lisez les valeurs dans globalMap.One call, one row. For several calls, put an Iterate link before it (tFlowToIterate, tLoop) and read the values from globalMap.

  1. Déposez le tWebServiceInput depuis la famille Internet de la palette. Donnez l'adresse du WSDL dans WSDL : "http://server.example.com/customers?wsdl".Drop the tWebServiceInput from the Internet family of the palette. Give the address of the WSDL in WSDL: "http://server.example.com/customers?wsdl".
  2. Écrivez le Nom de la méthode (l'opération du WSDL, entre guillemets) et une ligne de Paramètres par paramètre de la requête, dans l'ordre du WSDL.Write the Method name (the operation of the WSDL, in quotes) and one row of Parameters per parameter of the request, in the order of the WSDL.
  3. Créez le schéma : une colonne par valeur attendue de la réponse, dans l'ordre où elle arrive (voir La réponse). Choisissez le client dans Paramètres avancés › API.Create the schema: one column per value expected from the response, in the order it arrives (see The response). Choose the client in Advanced settings › API.

Paramètres simplesBasic settings

Les libellés sont ceux de l'onglet Composant, dans son ordre ; le nom technique, en gris, est celui du paramètre dans le fichier du job.Labels are those of the Component tab, in its order; the technical name, in grey, is the parameter name in the job file.

ParamètreSetting DéfautDefault VisibleShown Description
Type de propriétéProperty TypePROPERTY Built-in ToujoursAlways Built-in, ou Référentiel pour reprendre une métadonnée WSDL du projet (adresse, méthode, paramètres).Built-in, or Repository to reuse a WSDL metadata of the project (address, method, parameters).
SchémaSchemaSCHEMA videempty ToujoursAlways Les colonnes reçoivent les valeurs de la réponse par position, pas par nom : la première colonne la première valeur, etc. Chaque valeur est convertie selon le type de la colonne.The columns receive the values of the response by position, not by name: the first column the first value, and so on. Each value is converted according to the type of the column.
WSDLENDPOINT "" ToujoursAlways Adresse du WSDL, lu à chaque exécution ; le service appelé est celui de son soap:address.Address of the WSDL, read at every run; the called service is the one of its soap:address.
Authentification requise ?Need authentication?NEED_AUTH NonNo ToujoursAlways HTTP Basic. Axis : pour le WSDL et l'appel. CXF : pour l'appel seulement, un WSDL protégé fait échouer le composant (voir Pièges).HTTP Basic. Axis: for the WSDL and the call. CXF: for the call only, a protected WSDL makes the component fail (see Pitfalls).
UtilisateurUsernameAUTH_USERNAME "username" Authentification requise ? cochéeNeed authentication? checked Compte sur le service.Account on the service.
Mot de passePasswordAUTH_PASSWORD "password" Authentification requise ? cochéeNeed authentication? checked Une valeur entre guillemets est chiffrée dans le code généré.A value in quotes is encrypted in the generated code.
Authentification Windows ?Windows authentication?WIN_AUTH NonNo API AXIS et Authentification requise ? cochéeAPI AXIS and Need authentication? checked NTLM : l'appel passe par Commons HttpClient 3.1 avec domaine\utilisateur. Lu dans le modèle, non essayé (pas de serveur NTLM d'essai).NTLM: the call goes through Commons HttpClient 3.1 with domain\user. Read in the template, not tried (no test NTLM server).
DomaineDomainDOMAIN "windows_domain" Authentification Windows ? cochéeWindows authentication? checked Domaine Windows, une chaîne entre guillemets (le modèle colle domaine et utilisateur à la génération).Windows domain, a string in quotes (the template glues domain and user at generation).
Utiliser un proxy httpUse http proxyUSE_PROXY NonNo ToujoursAlways Pose aussi http.proxyHost et http.proxyPort pour toute la JVM. Axis : proxy authentifié accepté. CXF : l'utilisateur du proxy n'est pas transmis, un proxy authentifié répond 407.Also sets http.proxyHost and http.proxyPort for the whole JVM. Axis: authenticated proxy accepted. CXF: the proxy user is not passed on, an authenticated proxy answers 407.
Hôte du proxyProxy hostPROXY_HOST "127.0.0.1" Utiliser un proxy http cochéUse http proxy checked Nom ou adresse du proxy.Name or address of the proxy.
Port du proxyProxy portPROXY_PORT "8080" Utiliser un proxy http cochéUse http proxy checked Un texte, entre guillemets : le code le passe à System.setProperty.A text, in quotes: the code passes it to System.setProperty.
Utilisateur(trice) du proxyProxy userPROXY_USERNAME "" Utiliser un proxy http cochéUse http proxy checked Compte du proxy (Axis seulement, voir plus haut).Account of the proxy (Axis only, see above).
Mot de passe du proxyProxy passwordPROXY_PASSWORD "" Utiliser un proxy http cochéUse http proxy checked Mot de passe du proxy.Password of the proxy.
Sécuriser le serveur avec SSLTrust server with SSLNEED_SSL_TO_TRUSTSERVER NonNo ToujoursAlways Pose javax.net.ssl.trustStore et son mot de passe pour toute la JVM. Un WSDL et un service en HTTPS, au certificat d'essai, ont été appelés avec les deux clients.Sets javax.net.ssl.trustStore and its password for the whole JVM. A WSDL and a service over HTTPS, with the test certificate, were called with both clients.
Fichier TrustStoreTrustStore fileSSL_TRUSTSERVER_TRUSTSTORE "C:/clientTrustStore.trustStore" Sécuriser le serveur avec SSL cochéTrust server with SSL checked Magasin du certificat du serveur ; un JKS a été lu.Store of the certificate of the server; a JKS was read.
Mot de passe du TrustStoreTrustStore passwordSSL_TRUSTSERVER_PASSWORD "password" Sécuriser le serveur avec SSL cochéTrust server with SSL checked Mot de passe du magasin. Les champs de magasin de clés qui suivent dans le fichier du composant (SSL_TRUSTSERVER_KEYSTORE) dépendent d'un paramètre KEYSTORE_TYPE que le composant n'a pas, et aucun modèle ne les lit.Password of the store. The key store fields that follow in the component file (SSL_TRUSTSERVER_KEYSTORE) depend on a KEYSTORE_TYPE setting that the component does not have, and no template reads them.
Nom de la méthodeMethod nameMETHOD "" ToujoursAlways L'opération : "hello", ou "hello(CustomerPort)" pour choisir le port. Sans port, Axis prend un port SOAP 1.1 du service. "runJob" appelle l'ancien service web d'un job Talend (Axis seulement ; refusé par CXF).The operation: "hello", or "hello(CustomerPort)" to choose the port. Without a port, Axis takes a SOAP 1.1 port of the service. "runJob" calls the old web service of a Talend job (Axis only; rejected by CXF).
Délai avant expiration (secondes)Time out(second)TIMEOUT 20 ToujoursAlways Axis : attente de la réponse, un entier (le code appelle setTimeOut(int)). CXF : connexion et réponse, décimales permises.Axis: wait for the response, an integer (the code calls setTimeOut(int)). CXF: connection and response, decimals allowed.
ParamètresParametersPARAMS videempty ToujoursAlways Une colonne valeur, une expression Java par paramètre, dans l'ordre de la requête : "Ada", 20, context.city. Axis convertit chaque valeur en texte (toString()), puis dans le type du WSDL ; CXF la passe telle quelle. Axis exige autant de lignes que de paramètres (Need 2 arguments!!!) ; CXF envoie ce qu'il a.One value column, one Java expression per parameter, in the order of the request: "Ada", 20, context.city. Axis turns each value into text (toString()), then into the type of the WSDL; CXF passes it as is. Axis requires as many rows as parameters (Need 2 arguments!!!); CXF sends what it has.

Paramètres avancésAdvanced settings

ParamètreSetting DéfautDefault VisibleShown Description
APIAPI AXIS ToujoursAlways AXIS (Apache Axis 1.4, HTTP/1.0) ou CXF (Apache CXF 3.5.5, HTTP/1.1). Voir Axis ou CXF.AXIS (Apache Axis 1.4, HTTP/1.0) or CXF (Apache CXF 3.5.5, HTTP/1.1). See Axis or CXF.
Utilisation avancée (Va générer du code stub client en Routines)Advanced Use (It will generate client stub codes in Routines.)ADVANCED_USE NonNo API AXISAPI AXIS Cochée : le composant n'appelle plus rien lui-même ; il exécute le Code, qui utilise des classes clientes générées dans les routines par WSDL2Java.Checked: the component no longer calls anything itself; it runs the Code, which uses client classes generated in the routines by WSDL2Java.
WSDL2JavaWSDL2Java — Utilisation avancée cochéeAdvanced Use checked Bouton … : WSDL2Java d'Axis 1.4 génère les classes clientes du WSDL (paquet routines), chacune devient une routine du dossier routines/<job>/<composant>, avec les modules axis-1.4.jar et axis-jaxrpc-1.4.jar, et le job en dépend. Le WSDL est celui du champ WSDL, chaîne sans guillemets (pas de variable de contexte, comme dans le Studio). Une routine déjà présente sous ce nom est gardée. Bouton présent à partir de Talaxie 9.0.7 ; jusqu'à Talaxie 9.0.6, le champ s'affichait comme un simple texte.… button: Axis 1.4 WSDL2Java generates the client classes of the WSDL (package routines), each one becomes a routine of the routines/<job>/<component> folder, with the axis-1.4.jar and axis-jaxrpc-1.4.jar modules, and the job depends on them. The WSDL is the one of the WSDL field, a string without quotes (no context variable, as in the Studio). A routine already present under this name is kept. Button available from Talaxie 9.0.7; up to Talaxie 9.0.6, the field showed as plain text.
CodeCODE exemples en commentaireexamples in comments Utilisation avancée cochéeAdvanced Use checked Code Java inséré tel quel ; output_row y est remplacé par le nom du lien de sortie. Une boucle ouverte se ferme avec Accolade(s) fermante(s). Non essayé.Java code inserted as is; output_row is replaced with the name of the output link. An open loop is closed with Match Brackets. Not tried.
Accolade(s) fermante(s)Match BracketsMATCHBRACKETS Par défautDefault Utilisation avancée cochéeAdvanced Use checked }, } } ou } } } ajoutés à la fin du composant, après la ligne de sortie.}, } } or } } } added at the end of the component, after the output row.

Axis ou CXFAxis or CXF

Mêmes réglages, même service, des résultats différents. Mesuré avec le service d'essai des exemples :Same settings, same service, different results. Measured with the test service of the examples:

AXISCXF
Réponse de type simpleSimple type responsepremière colonnefirst columnpremière colonnefirst column
Réponse structurée (un client)Structured response (one customer)son XML entier dans la première colonne, les autres nullesits whole XML in the first column, the others nullses valeurs une par colonne, dans l'ordre du documentits values one per column, in document order
Liste de valeurs simplesList of simple valuesune valeur par colonneone value per columnune valeur par colonneone value per column
Liste de structuresList of structureserreur : could not find deserializer for type …Customererror: could not find deserializer for type …Customertoutes les valeurs à la suite, puis le nombre d'élémentsall the values one after the other, then the number of elements
Paramètre manquantMissing parameterrefusé avant l'envoirejected before sendingrequête incomplète envoyéeincomplete request sent
WSDL protégé par BasicWSDL protected by Basiclureadéchec (Failed to create service.)failure (Failed to create service.)
Proxy authentifiéAuthenticated proxyacceptéacceptedéchec (407 sur le WSDL)failure (407 on the WSDL)
RequêteRequestHTTP/1.0, déclaration XML, SOAPAction entre guillemets, Basic d'embléeHTTP/1.0, XML declaration, quoted SOAPAction, Basic up frontHTTP/1.1, SOAPAction entre guillemets, Basic d'embléeHTTP/1.1, quoted SOAPAction, Basic up front

Requête d'Axis pour add (20, 22), dans le journal du service d'essai :Request of Axis for add (20, 22), in the log of the test service:

POST /customers HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: 127.0.0.1:8186
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "urn:add"
Content-Length: 327

<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><add xmlns="http://example.com/customers"><a>20</a><b>22</b></add></soapenv:Body></soapenv:Envelope>

ExemplesExamples

Sorties copiées depuis des exécutions des jobs (lancés depuis Talaxie, Java 21) contre un service SOAP d'essai installé sur le poste ; WSDL "http://127.0.0.1:8186/customers?wsdl". Job du schéma de Utilisation ; le tJava affiche NB_LINE, un second tJava relié par On Component Error affiche ERROR_MESSAGE. Sauf mention contraire, le résultat est le même avec les deux clients.Outputs copied from runs of the jobs (started from Talaxie, Java 21) against a test SOAP service installed on the machine; WSDL "http://127.0.0.1:8186/customers?wsdl". Job of the diagram of Usage; the tJava prints NB_LINE, a second tJava connected with On Component Error prints ERROR_MESSAGE. Unless stated otherwise, the result is the same with both clients.

Un paramètre, une valeurOne parameter, one value

Nom de la méthode "hello", Paramètres "Ada", schéma greeting (String) :Method name "hello", Parameters "Ada", greeting schema (String):

Hello, Ada!
tJava_1: NB_LINE = 1

"add" avec 20 et 22, schéma sum (Integer) :"add" with 20 and 22, sum schema (Integer):

42
tJava_1: NB_LINE = 1

Une réponse structuréeA structured response

"getCustomer" avec 2, schéma id, name, city (String). Axis :"getCustomer" with 2, id, name, city schema (String). Axis:

<ns1:customer xmlns:ns1="http://example.com/customers"><ns1:id>2</ns1:id><ns1:name>Grace Petit</ns1:name><ns1:city>Lyon</ns1:city></ns1:customer>||

CXF :

2|Grace Petit|Lyon

Avec Axis, découpez le XML de la première colonne (tExtractXMLField).With Axis, split the XML of the first column (tExtractXMLField).

Une liste de valeursA list of values

"listNames" avec "Paris" (le service renvoie deux éléments name), schéma first, second :"listNames" with "Paris" (the service returns two name elements), first, second schema:

Ada Martin|Linus Morel
tJava_1: NB_LINE = 1

Une colonne par élément : prévoyez-en assez, les éléments en trop sont perdus.One column per element: plan enough of them, the extra elements are lost.

Une liste de structuresA list of structures

"findCustomers" avec "Paris" (deux clients). CXF, schéma de sept colonnes String :"findCustomers" with "Paris" (two customers). CXF, schema of seven String columns:

1|Ada Martin|Paris|3|Linus Morel|Paris|2
tJava_1: NB_LINE = 1

Les trois valeurs du premier client, les trois du second, puis leur nombre. Avec trois colonnes, seul le premier client est resté (1|Ada Martin|Paris). Axis refuse la réponse (pile abrégée) :The three values of the first customer, the three of the second, then their count. With three columns, only the first customer stayed (1|Ada Martin|Paris). Axis rejects the response (shortened stack):

Exception in component tWebServiceInput_1 (MyJob)
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXException: Deserializing parameter 'customer':  could not find deserializer for type {http://example.com/customers}Customer
	…

Une faute SOAPA SOAP fault

"getCustomer" avec 99, client inconnu. Axis (nom du job remplacé par MyJob, pile abrégée) :"getCustomer" with 99, unknown customer. Axis (job name replaced with MyJob, shortened stack):

Exception in component tWebServiceInput_1 (MyJob)
AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode:
 faultString: Unknown customer 99
 faultActor:
 faultNode:
 faultDetail:
	{http://example.com/customers}customerFault:<tns:id>99</tns:id>

Unknown customer 99
	at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
	…
tJava_2 (On Component Error): ERROR_MESSAGE = Unknown customer 99

CXF :

Exception in component tWebServiceInput_1 (MyJob)
org.apache.cxf.binding.soap.SoapFault: Unknown customer 99
	at org.apache.cxf.binding.soap.interceptor.Soap11FaultInInterceptor.unmarshalFault(Soap11FaultInInterceptor.java:87)
	…
tJava_2 (On Component Error): ERROR_MESSAGE = Unknown customer 99

Il n'y a pas de case Arrêter en cas d'erreur : sans lien On Component Error, le job s'arrête avec le code 1. Aucune ligne ne sort.There is no Die on error box: without an On Component Error link, the job stops with code 1. No row comes out.

Les erreursErrors

Première ligne de l'exception, et ERROR_MESSAGE quand il diffère. Les fautes d'Axis contiennent aussi le nom de la machine du job ({http://xml.apache.org/axis/}hostname).First line of the exception, and ERROR_MESSAGE when it differs. The Axis faults also hold the name of the machine of the job ({http://xml.apache.org/axis/}hostname).

CasCaseAXISCXF
Opération inconnue ("goodbye")Unknown operation ("goodbye")javax.xml.rpc.JAXRPCException: Cannot find operation: goodbye - none definedjava.lang.RuntimeException: can't find the operation : goodbye with port : null
Un paramètre sur deuxOne parameter out of twojava.lang.RuntimeException: Need 2 arguments!!!la faute du service (a and b must be integers)the fault of the service (a and b must be integers)
Délai dépassé (2 s, réponse en 6 s)Timeout exceeded (2 s, response in 6 s)AxisFault … faultString: java.net.SocketTimeoutException: Read timed out ; ERROR_MESSAGE commence par ; nested exception is:AxisFault … faultString: java.net.SocketTimeoutException: Read timed out; ERROR_MESSAGE starts with ; nested exception is:org.apache.cxf.interceptor.Fault: Could not receive Message.
WSDL protégé par Basic, identifiant fourniWSDL protected by Basic, credentials givenappel réussisuccessful callorg.apache.cxf.service.factory.ServiceConstructionException: Failed to create service., cause Server returned HTTP response code: 401 for URL: …?wsdlorg.apache.cxf.service.factory.ServiceConstructionException: Failed to create service., cause Server returned HTTP response code: 401 for URL: …?wsdl
Proxy authentifiéAuthenticated proxyappel réussisuccessful callFailed to create service., cause Server returned HTTP response code: 407 for URL: …?wsdlFailed to create service., cause Server returned HTTP response code: 407 for URL: …?wsdl

Variables globalesGlobal variables

NB_LINE
Integer, Nombre de lignes : 1 après un appel réussi (une ligne par appel).Integer, Number of line: 1 after a successful call (one row per call).
ERROR_MESSAGE
String : message de l'erreur, comme pour tout composant.String: message of the error, as for any component.
((Integer) globalMap.get("tWebServiceInput_1_NB_LINE"))
((String) globalMap.get("tWebServiceInput_1_ERROR_MESSAGE"))

PiègesPitfalls

CXF : WSDL protégé ou proxy authentifié impossiblesCXF: protected WSDL or authenticated proxy impossible

Avec API CXF, le WSDL est relu par CXF sans identifiant : un WSDL protégé par Basic a donné 401, même avec Authentification requise ? cochée. De même, l'utilisateur du proxy n'est pas transmis : 407. Avec ces services, restez sur Axis, ou donnez une copie locale du WSDL.With API CXF, the WSDL is read again by CXF without credentials: a WSDL protected by Basic gave 401, even with Need authentication? checked. Likewise, the proxy user is not passed on: 407. With these services, stay on Axis, or give a local copy of the WSDL.

Les colonnes se remplissent par positionThe columns are filled by position

Le nom des colonnes ne compte pas : la première reçoit la première valeur. Une colonne en trop reste nulle, une valeur en trop est perdue, sans message. Avec CXF et une liste de structures, le nombre d'éléments vient après les valeurs (exemple Une liste de structures).The name of the columns does not matter: the first one receives the first value. An extra column stays null, an extra value is lost, with no message. With CXF and a list of structures, the number of elements comes after the values (example A list of structures).

Pas de proxy pour localhostNo proxy for localhost

Java ne passe pas par un proxy pour localhost et 127.* (http.nonProxyHosts par défaut) : pour nos essais avec un proxy local, le job a été lancé avec -Dhttp.nonProxyHosts=.Java does not go through a proxy for localhost and 127.* (default http.nonProxyHosts): for our runs with a local proxy, the job was started with -Dhttp.nonProxyHosts=.

Le proxy et l'identifiant restent dans la JVMThe proxy and the credentials stay in the JVM

Le composant pose http.proxyHost, http.proxyPort et le TrustStore en propriétés système, et confie l'identifiant à Java (Authenticator, avec Axis) : ces réglages valent ensuite pour toutes les connexions HTTP du job.The component sets http.proxyHost, http.proxyPort and the TrustStore as system properties, and gives the credentials to Java (Authenticator, with Axis): these settings then apply to all the HTTP connections of the job.

Voir aussiSee also