One Star

Sending XML requests in file to a Web Service (SOAP)

Hello,
I have recently started using Talend and am a bit stuck on how I am able to send a request to a webservice where the request is read in from an already set up XML file.
My use case is to process a delimited file, convert the records into an XML file formatted for the WS call and then send the request to that call. I am not interested in any processing of the response since this call is just updating some fields in a database.
I have been able to read in my base file and convert it into an XML document that has a request setup for every record in the original file one after the other. 
Example (psuedo xml for example purposes, not exact):
 <processTrans>
       <xref>019558-401010101-bdb0fc91-db88-411f-b9ff-84a832bf672a</xref>
        <type>7</type>
        <transDate>2013-09-16 00:00:00</transDate>
        <amount>00004221</amount>
        <accountId>401010101</accountId>
</processTrans>
<processTrans>
       <xref>019558-401010101-gj6814-gb99-411f-aa88-90ad44338cb</xref>
        <type>8</type>
        <transDate>2014-09-16 00:00:00</transDate>
        <amount>0000672111</amount>
        <accountId>5010101</accountId>
</processTrans>
So basically my input file into the service is going to be many requests with the end tag of the previous request, and the start tag of the new request, just separated by a line break. Is there a way for me to send this file to some type of component that will send it as a request to my service and loop through all requests in the file?
Any help is greatly appreciated! Thank you!
3 REPLIES
Community Manager

Re: Sending XML requests in file to a Web Service (SOAP)

Hi
tXMLMap component is used to generate a document with XML format and sent it as request to tESBResumer that calls the web service. In your case, the job looks like:
tFileInputDelimited--main--tXMLMap--out-->tESBConsumer--tLogRow
Take a look at the component manual of tXMLMap component:
https://help.talend.com/search/all?query=tXMLMap&content-lang=en
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Sending XML requests in file to a Web Service (SOAP)

Hello Shong, thank you for the response.
My current Job looks something like this tFileInputMSPositional --> tMap --> tAdvancedFileOutputXML --> tSOAP
The XML request data is all being formatted in the map and then output via tAdvancedFileOutputXML. Do you think this works just fine as well?
So it looks like I had it pretty close to what you mentioned, I will take the suggestion of using tESBConsumer and see if I can get it to work that way. 
Community Manager

Re: Sending XML requests in file to a Web Service (SOAP)

Hello Shong, thank you for the response.
My current Job looks something like this tFileInputMSPositional --> tMap --> tAdvancedFileOutputXML --> tSOAP
The XML request data is all being formatted in the map and then output via tAdvancedFileOutputXML. Do you think this works just fine as well?
So it looks like I had it pretty close to what you mentioned, I will take the suggestion of using tESBConsumer and see if I can get it to work that way. 

It is impossible to upload a xml file as request parameter with tSOAP. Don't now if you have tried tESBConsumer which accepts a document as request, please give us your feedback.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business