ComposantsComponents › Internet
Effectue une requête sur un serveur XML-RPC et lit les résultats : il appelle une méthode (Calculator.add) avec des paramètres, puis range le résultat dans les colonnes de son schéma, une ligne par élément si le résultat est un tableau. Le client est celui d'Apache XML-RPC 3.1.3, sur Commons HttpClient. Pour un service SOAP, prenez un tWebServiceInput ; pour une API REST, un tRESTClient.Requests an XML-RPC server and reads its result: it calls a method (Calculator.add) with parameters, then stores the result in the columns of its schema, one row per element if the result is an array. The client is the one of Apache XML-RPC 3.1.3, over Commons HttpClient. For a SOAP service, take a tWebServiceInput; for a REST API, a tRESTClient.
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, ou une par élément d'un résultat tableau.One Main link: one row, or one per element of an array result.
Déclencheurs en sortieOutput triggers
On Subjob Ok On Subjob Error On Component Ok On Component Error Run if
Cette page n'a pas d'exemple exécuté : le fonctionnement décrit est lu dans le modèle du composant et dans le code Java qu'il génère, pour un job fait dans Talaxie.This page has no run example: the behavior described is read in the template of the component and in the Java code it generates, for a job made in Talaxie.
Un appel, puis une ligne par valeur reçue ; le tJava peut lire tXMLRPCInput_1_NB_LINE.One call, then one row per value received; the tJava can read tXMLRPCInput_1_NB_LINE.
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. Le composant n'a pas de paramètres avancés propres.Labels are those of the Component tab, in its order; the technical name, in grey, is the parameter name in the job file. The component has no advanced settings of its own.
| ParamètreSetting | DéfautDefault | VisibleShown | Description |
|---|---|---|---|
| SchémaSchemaSCHEMA | videempty | ToujoursAlways | Colonnes remplies par position (voir Fonctionnement). Évitez les types Date et byte[] : le code généré ne compile pas (voir Pièges).Columns filled by position (see How it works). Avoid the Date and byte[] types: the generated code does not compile (see Pitfalls). |
| URL du serveurServer urlSERVER-URL | "http://127.0.0.1:8080/xmlrpc" |
ToujoursAlways | Adresse du point d'entrée XML-RPC, http ou https ; elle passe par new java.net.URL(…) au début du composant.Address of the XML-RPC endpoint, http or https; it goes through new java.net.URL(…) at the start of the component. |
| Authentification requise ?Need authentication?NEED_AUTH | OuiYes | ToujoursAlways | HTTP Basic (setBasicUserName, setBasicPassword). Cochée par défaut, contrairement aux autres composants de la famille.HTTP Basic (setBasicUserName, setBasicPassword). Checked by default, unlike the other components of the family. |
| UtilisateurUsernameAUTH_USERNAME | "username" |
Authentification requise ? cochéeNeed authentication? checked | Compte sur le serveur.Account on the server. |
| Mot de passePasswordAUTH_PASSWORD | "password" |
Authentification requise ? cochéeNeed authentication? checked | Une valeur entre guillemets est chiffrée dans le code généré et déchiffrée au lancement.A value in quotes is encrypted in the generated code and decrypted at launch. |
| MéthodeMethodMETHOD | "Calculator.add" |
ToujoursAlways | Nom de la méthode, une expression Java de type texte.Name of the method, a Java expression of type text. |
| ParamètresParametersPARAMS | videempty | ToujoursAlways | Colonnes (nom), valeur et Classe. Seule valeur compte : une expression Java par argument, envoyée avec son propre type (20 part en entier, "20" en texte). Le nom et la classe ne sont pas lus par le modèle.name, value and class columns. Only value matters: one Java expression per argument, sent with its own type (20 leaves as an integer, "20" as text). The name and the class are not read by the template. |
Code généré pour URL du serveur "http://127.0.0.1:8187/RPC2", Méthode "Calculator.add", Paramètres 20 et 22, authentification demo (extrait, mot de passe chiffré abrégé) :Code generated for Server url "http://127.0.0.1:8187/RPC2", Method "Calculator.add", Parameters 20 and 22, authentication demo (excerpt, encrypted password shortened):
org.apache.xmlrpc.client.XmlRpcClientConfigImpl configtXMLRPCInput_1= new org.apache.xmlrpc.client.XmlRpcClientConfigImpl();
configtXMLRPCInput_1.setServerURL(new java.net.URL("http://127.0.0.1:8187/RPC2"));
configtXMLRPCInput_1.setEnabledForExtensions(true);
configtXMLRPCInput_1.setConnectionTimeout(60 * 1000);
configtXMLRPCInput_1.setReplyTimeout(60 * 1000);
configtXMLRPCInput_1.setBasicUserName("demo");
final String decryptedPassword_tXMLRPCInput_1 = routines.system.PasswordEncryptUtil.decryptPassword("enc:routine.encryption.key.v1:…");
configtXMLRPCInput_1.setBasicPassword(decryptedPassword_tXMLRPCInput_1);
org.apache.xmlrpc.client.XmlRpcClient clienttXMLRPCInput_1 = new org.apache.xmlrpc.client.XmlRpcClient();
// use Commons HttpClient as transport
clienttXMLRPCInput_1.setTransportFactory(
new org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory(clienttXMLRPCInput_1));
// set configuration
clienttXMLRPCInput_1.setConfig(configtXMLRPCInput_1);
// make the a regular call
Object[] params_tXMLRPCInput_1 = new Object[] {
20,
22,
};
…
Object reValuetXMLRPCInput_1 = clienttXMLRPCInput_1.execute("Calculator.add", params_tXMLRPCInput_1);
setEnabledForExtensions(true)), sans réglage.The Apache XML-RPC extensions are on (setEnabledForExtensions(true)), with no setting.String.valueOf) dans la première colonne, les autres nulles.Simple element: its text (String.valueOf) in the first column, the others null.struct) : ses valeurs remplissent les colonnes dans l'ordre de map.values(), sans lien avec le nom des membres ; un tableau dans la structure devient un Object[].Structure element (struct): its values fill the columns in the order of map.values(), with no link to the names of the members; an array inside the structure becomes an Object[].ParserUtils.parseTo_Integer(…)…).Each value is then converted from its text according to the type of the column (ParserUtils.parseTo_Integer(…)…).((Integer) globalMap.get("tXMLRPCInput_1_NB_LINE"))
Pour ces deux types, le modèle écrit du code qui traite la valeur reçue (de type Object) comme un texte. Schéma result (Integer), text (String), when (Date), data (byte[]) ; messages du compilateur Java 21 sur le code généré (nom du job remplacé par MyJob) :For these two types, the template writes code that treats the received value (of type Object) as a text. Schema result (Integer), text (String), when (Date), data (byte[]); messages of the Java 21 compiler on the generated code (job name replaced with MyJob):
MyJob.java:1029: error: no suitable method found for parseTo_Date(Object,<null>)
row1.when = ParserUtils.parseTo_Date(results_tXMLRPCInput_1[2], null);
^
method ParserUtils.parseTo_Date(String,String) is not applicable
(argument mismatch; Object cannot be converted to String)
method ParserUtils.parseTo_Date(Date,String) is not applicable
(argument mismatch; Object cannot be converted to Date)
MyJob.java:1035: error: cannot find symbol
row1.data = results_tXMLRPCInput_1[3].getBytes();
^
symbol: method getBytes()
location: class Object
Recevez ces valeurs dans une colonne String (ou Object), puis convertissez-les dans un tJavaRow ou un tConvertType.Receive these values in a String (or Object) column, then convert them in a tJavaRow or a tConvertType.
Choisir java.lang.Integer.class pour un argument écrit "20" n'en fait pas un entier : il part en texte. Écrivez l'expression dans le type voulu (20, Integer.parseInt(context.n)).Choosing java.lang.Integer.class for an argument written "20" does not make it an integer: it leaves as text. Write the expression in the wanted type (20, Integer.parseInt(context.n)).
Les valeurs d'une structure sont prises dans l'ordre de map.values(), sans lien avec le nom des colonnes ni des membres. Contrôlez l'ordre obtenu sur un premier appel avant de vous fier aux colonnes.The values of a structure are taken in the order of map.values(), with no link to the names of the columns or of the members. Check the order obtained on a first call before relying on the columns.
tWebServiceInput · appeler un service SOAP à paramètres simplescall a SOAP service with simple parameterstRESTClient · appeler une API RESTcall a REST APItHttpRequest · envoyer une requête HTTP écrite à la mainsend a hand-written HTTP requesttJavaRow · convertir une valeur reçue en texteconvert a value received as text