Working with tXMLRPCInput

Highlighted
Eight 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")
Eight 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.

Eight 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

 

 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog

Why Companies Move to the Cloud: 7 Success Stories

Learn how and why companies are moving to the Cloud

Read Now

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch