Five Stars

Webservice, wsdl, ComplexContent and array in schema


I use the TOS Community, ver 6.4 on linux, with Oracle's JDK.

I just started to learn and use Talend for ETL (evaluation) tasks. Longer term is replacing old but working Jitterbit community server with Talend. So, if you know Jitterbit, you can imagine the situation.


Anyway, I have a task:

Read a filtered table from Postgresql Database, connecting to a webservice and upload data, handling the response from the webservice. Seems pretty easy, good for learning the basics of Talend.

I figured out a simple job, including tMap, because I have to create several parameters on the fly, using the database.

Calling webservice using filtered tableCalling webservice using filtered table

The problem is, there are some "fields" in the webservice schema, where I cannot create the correct value.

Error message (snippet, as this one repeats several times, due to the repeated invoking of webservice):

Error compiling schema from WSDL at {file:/tmp/wsdl14984695792081/mainWSDL.wsdl}:
undefined simple or complex type 'SOAP-ENC:Array'
at line 9 column 4 of schema file:/tmp/wsdl14984695792081/mainWSDL.wsdl

undefined attribute 'SOAP-ENC:arrayType'
at line 10 column 5 of schema file:/tmp/wsdl14984695792081/mainWSDL.wsdl


So, as the bold red attributes are defined during creating the webservice, I show you the relevant parts of the wsdl file in raw format, which causes problems.


WSDL snippets:

In the types section I have the following types defined:
 <xsd:complexType name="strArray">
   <xsd:restriction base="SOAP-ENC:Array">
    <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="xsd:string[]"/>
 <xsd:complexType name="serviceData">
   <xsd:element name="code" type="xsd:string"/>
   <xsd:element name="value" type="xsd:string"/>
 <xsd:complexType name="serviceArray">
   <xsd:restriction base="SOAP-ENC:Array">
    <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:serviceData[]"/>

In the message I have the following parts:
<part name="note" type="xsd:string" />
<part name="ref_num" type="xsd:string" />
<part name="services" type="tns:serviceArray" />
<part name="pcl_numbers" type="tns:strArray" />
<part name="labels_data_type" type="xsd:string" />


So, as you can see above, the message contains two "fields", where I have to put complex data, not just a string or int, but string array into pcl_numbers and key/value pairs into services.

For example:

  • there are one or more pcl_numbers in the database, so, I have to build an array with one or more element and feed the pcl_numbers: "1234567" and "9876543" as individual pcl_numbers, but I have to create a string array and write into the schema. Q1: How?
  • there are several fields in the database, where I have to create key/value pairs for non-null values and create an array with these pairs.
    The number of key/value depends on the database: if a specific field is not-null, key/value created, example: database has these fields: service1=NULL, service2='D1', service3='H34', service4='G0'
    The generated key/values array must be in the xml:  code="service2" , value="D1" ; code="service3", value="H34"; code="service4", value="G0"  (please note, service1 does not exist in the array, because it has no value, so, using if statement that key/value will not be created)
    Q2: How?


So, here are the steps I did to create the webservice:

  1. Created a new webservice, using the wsdl link and choosed the required method of the service. Click next.
  2. In the input mapping, I got the top-level schema where I can see the dynamic group, called services and pcl_numbers.webservice input mappingwebservice input mapping
    Please note, sender and consig are easy, only strings under the group and they are working well.
  3. Clicking on Services and + above the schema area, I got the following popup Parameter tree:
    Parameter treeParameter tree
  4. Choosing the parameter and clickin on OK I got this:Parameter insertedParameter inserted
  5. After creating the input mapping in webservice, I got this:
    Input mappingInput mapping
  • So, as you can see, pcl_numbers on the SOAP schema have to be an array of strings, but I only have string in the tMap (not shown). I do not know, how to create an array of strings inside the Expression Editor of the tMap component, this is the Question 1.


  • The Question 2 seems more difficult, as I have to build key/value pairs on the fly from about 8 database fields and creating an array of them using the Expression Editor of the tMap component to pass to the webservice.


Sorry about the long article, I hope I provided all necessary information to catch the task and my problem.


I already checked the Tutorials, got the component reference and user manual, load the demo jobs, but I did not really feel the power of Talend, yet. In fact, Jitterbit is very old, but using its expression editor I was able to write even long scripts, using local variables and pass them as return values without too much pain.


So, can you help me sort out of these small problems and/or point to some similar examples, instead of 1-1 mapping of flat data? I will have more tasks, where I will have to manage structured data (tree) from/to flat format (between xml, dbf, xls, csv, DB, webservice).



Community Manager

Re: Webservice, wsdl, ComplexContent and array in schema

For testing, create a string array on tJava, put the array to a global variable and get the value of this variable in the expression on tWebservice, set other fileds with constant to test if the webservice is called successfully by passing array parameter. eg:

on tJava:
String[] strArray={"123456789","9876543"};

on tWebservice, get the value of this variable in the Expression field for array elements.
String[] s=(String[])globalMap.get("key")

Set a fixed value to other fields with non-array type.


If it works, you will read value from data source and pass them to twebservice.


Talend | Data Agility for Modern Business
Five Stars

Re: Webservice, wsdl, ComplexContent and array in schema


Thanks for the hint, I will give it a try.