This scenario describes a three-component Job that uses a SOAP message from an input XML file to invoke a Web service for the country name information which corresponds to the country code IR, and writes the response to an XML file.
Drop the following components from the Palette onto the design workspace: tFileInputXML, tSOAP, and tFileOutputXML.
Connect the components using Row > Main links.
Double-click the tFileInputXML component to open its Basic settings view.
Click the [...] button next to Edit schema to open the [Schema] dialog box.
Click the [+] button to add a column, give it a name, getCountryName in this example, and select Document from the Type list. Then, click OK to close the dialog box.
In the File name/Stream field, enter the path to the input XML file that contains the SOAP message to be used, or browse to the path by clicking the [...] button.
The input file contains the following SOAP message and you can see that the given country code is IR:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET"> <soapenv:Header/> <soapenv:Body> <web:GetCountryByCountryCode> <web:CountryCode>IR</web:CountryCode> </web:GetCountryByCountryCode> </soapenv:Body> </soapenv:Envelope>
In the Loop XPath query field, enter
"/"to define the root as the loop node of the input file structure.
In the Mapping table, fill the XPath query column with
"."to extract all data from context node of the source, and select the Get Nodes check box to build a Document type data flow.
Double-click the tSOAP component to open its Basic settings view.
In ENDPOINT field, enter or copy-paste the URL address of the Web service to be used between the quotation marks: "http://www.webservicex.net/country.asmx".
In the SOAP Action field, enter or copy-paste the URL address of the SOAPAction HTTP header field that indicates that you want to retrieve the country name information: http://www.webserviceX.NET/GetCountryByCountryCode.
Select the Use a message from the schema check box, and select a Document type column from the SOAP Message list to read the SOAP message from the input file to send to the Web service. In this example, the input schema has only one column, getCountryName.
Select the Output in Document check box to output the response message in XML format.
Double-click the tFileOutputXML component to open its Basic settings view.
In the File Name field, enter the path to the output XML file.
Select the Incoming record is a document check box to retrieve the incoming data flow as an XML document. Note that a Column list appears allowing you choose a column to retrieve data from. In this example, the schema contains only one column.