Contents of a csv file
Post any question you may have in regards to GoAnywhere Director and let our talented support staff and other users assist you.
2 posts
Page 1 of 1
- Posts: 17
- Joined: Thu May 08, 2014 2:07 am
I need to get the contents of a csv file to be sent as one of the elements in a soap request to call a web service. When I use set variable to get contents (specifying file path), the data set in the variable is all junk values and not real data. Also my file is relatively large having customer related details. Could you please help with this requirement using Goanywhere.
- Support Specialist
- Posts: 62
- Joined: Thu Jul 19, 2012 9:15 am
- Location: Ashland, NE
-
Shoma,
You should be able to set your variable to the file needed and include that as the value of your XML element as in this example.
If you have issues with the appearance of the file contents, please verify the encoding of your input csv file. You may need to specify that on the set variable task and may also need to adjust the header of your XML to specify proper encoding as well.
Thanks - Jon
You should be able to set your variable to the file needed and include that as the value of your XML element as in this example.
Code: Select all
<project name="CSV in XML" mainModule="Main" version="2.0">
<module name="Main">
<setVariable label="set variable to file contents" name="contents" inputFile="/linoma/goanywhere/userdata/documents/user/sample.csv" version="2.0" />
<print label="print file contents to job log" version="1.0">
<![CDATA[-- begin file contents --
${contents}
-- end file contents --]]>
</print>
<xmlWrite label="write XML" outputFile="/linoma/goanywhere/userdata/documents/user/output.xml" version="1.0">
<header><?xml version="1.0" encoding="UTF-8" ?></header>
<element name="file" value="${contents}" />
</xmlWrite>
</module>
</project>
If you have issues with the appearance of the file contents, please verify the encoding of your input csv file. You may need to specify that on the set variable task and may also need to adjust the header of your XML to specify proper encoding as well.
Code: Select all
I hope this helps you out.<setVariable label="set variable to file contents" name="contents" inputFile="/linoma/goanywhere/userdata/documents/user/sample.csv" encoding="utf-8" version="2.0" />
Thanks - Jon
2 posts
Page 1 of 1