format soap request body tESBConsumer

One Star

format soap request body tESBConsumer

Greetings,
Is it possible to encode the xml tags of the body of a SOAP request in Talend using tXMLMap->tESBConsumer or another component prior to sending the request?
Talend returns errors for the following request with raw xml tags present:
<soap:Envelope>
<soap:Body>
<shipmentEnvelope>
<shipment>
<details>
<shipmentCurrencyCode>USD</shipmentCurrencyCode>
<shipmentType>AIATA</shipmentType>
<measurementType>MET</measurementType>
<exportCountry>US</exportCountry>
<importCountry>ES</importCountry>
</details>
</shipment></shipmentEnvelope></soap:Body></soap:Envelope>
I tested in a SOAP client and received a similar error. However, when encoding the XML tags of the SOAP:Body i get the desired result:
<soap:Envelope>
<soap:Body>
<shipmentEnvelope>
&lt;shipment&gt;
&lt;details&gt;
&lt;shipmentCurrencyCode&gt;USD&lt;/shipmentCurrencyCode&gt;
&lt;shipmentType&gt;AIATA&lt;/shipmentType&gt;
&lt;measurementType&gt;MET&lt;/measurementType&gt;
&lt;exportCountry&gt;US&lt;/exportCountry&gt;
&lt;importCountry&gt;ES&lt;/importCountry&gt;
&lt;/details&gt;
&lt;/shipment&gt;
</shipment></shipmentEnvelope></soap:Body></soap:Envelope>
Is it possible to encode the XML tags for the body of the payload and not the header? If so-what approach/components should I use to accomplish this?
Seventeen Stars

Re: format soap request body tESBConsumer

This is not the way how soap works. The payload will be send typically with a name space in it. This way you do not have to bother with encodings! What about creating your own shipment name space  - lets call it ship.
Now you create your payload:
<ship:shipmentEnvelope xmlns:ship="http://mycompany/">
... now you can use the name space for all further tags (not necessary to repeat the declaration).
One Star

Re: format soap request body tESBConsumer

Thanks for the reply. I actually removed the namespaces from the example; the envelope does have a namespace in both instances. Sorry for the confusion.
For some reason, however, I am unable to send the raw XML. I can only get the payload to successfully send when replacing the xml greater than/less than tags with &gt; and &lt;. The soap:header doesn't appear to have an issue with the raw XML, but anything within the soap:body in raw XML format is giving me issues. Is there any way to programatically replace the xml tags in just the soap:body? Can this be done with a component or would I need to write custom code in order to do this?
Seventeen Stars

Re: format soap request body tESBConsumer

There is a bug in the tESBConsumer component which damages the payload in case of names spaces are used.
https://jira.talendforge.org/browse/TESB-15758?jql=text%20~%20%22TDI-32849%22%20ORDER%20BY%20created...
The only current way it to switch to this release.
If you want stay on your solution, I suggest building the payload and use a tJavaRow component and simply java code to replace the xml tags.
One Star

Re: format soap request body tESBConsumer

Can I perform a replace operation using TJavaRow on a document data type?
Seventeen Stars

Re: format soap request body tESBConsumer

The document is an w3c document. It would be much easier to convert into a String (before you ask, I didn't have done this, Google is you friend ;-) and perform with it the replacements.

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

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog