Working with tXMLRPCInput

Highlighted
Six Stars

Working with tXMLRPCInput

I want the following input in my tXMLRPCInput:

<methodCall>
    <methodName>execute</methodName>
    <params>
        <param>
            <value><string>dbname</string></value>
        </param>
        <param>
               <value><int>2</int></value>
        </param>
        <param>
               <value><string>fou</string></value>
        </param>
        <param>
            <value><string>some.module</string></value>
        </param>
        <param>
            <value><string>some_method</string></value>
        </param>
        
        <!-- params -->
        <param>
            <param>
            	<value><string>some.model_name</string></value>
            </param>
            
            <param>
            	<value><string>another_param</string></value>
            </param>
        </param>
    </params>
</methodCall>

I didn't find any example on how to use multi-dimensional value (struct, map, list, etc) for this component. Any clue?

 

Thanks.

Tags (2)

Accepted Solutions
Community Manager

Re: Working with tXMLRPCInput

OK, well looking at the structure I would try out the java.lang.Object[].class option and create a String[] of your values in Java. Save that in the globalMap and reference that in the component. For example....

 

String[] array = { "hello", "world", "how",
    "are", "you" };
globalMap.put("array",array);

 This works perfectly using this useful site for testing this sort of stuff out ....

http://phpxmlrpc.sourceforge.net/server.php?methodName=interopEchoTests.echoStringArray

 

 


All Replies
Community Manager

Re: Working with tXMLRPCInput

You can do this by using the Java classes that are specified for each parameter. So for a Map (for example), you can build your map data in a tJava like so....

 

java.util.Map map = new java.util.HashMap();
map.put("name", "James");
map.put("age", 23);
map.put("address", "12 Baker Street");

globalMap.put("map_data", map);

The map is added to the globalMap so that you can use it anywhere in the job. When you get to your tXMLRPCInput component, your map parameter will be set up with a class value of "java.util.Map.class" and your value will be....

globalMap.get("map_data")
Six Stars

Re: Working with tXMLRPCInput

Thanks but the structure don't look like a map, didn't work. I tried Vector<Object> too but didn't work, List neither. Unfortunately, there is no way to print out the data sent for debugging purpose.
I am out of idea now Smiley Sad
Community Manager

Re: Working with tXMLRPCInput

What does the structure look like? Can I see the documentation anywhere? The structure example you posted I am not sure is a valid structure since I do not believe that a <param> element can contain a <param> element. I assumed that it was an example of the type of thing you wanted to achieve.

Six Stars

Re: Working with tXMLRPCInput

The structure above is correct and it works in Postman. The second param is the argument of the method some_method.
Community Manager

Re: Working with tXMLRPCInput

OK, well looking at the structure I would try out the java.lang.Object[].class option and create a String[] of your values in Java. Save that in the globalMap and reference that in the component. For example....

 

String[] array = { "hello", "world", "how",
    "are", "you" };
globalMap.put("array",array);

 This works perfectly using this useful site for testing this sort of stuff out ....

http://phpxmlrpc.sourceforge.net/server.php?methodName=interopEchoTests.echoStringArray

 

 

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.