[Logo]
Forums Register Login
Flat File to SOAP XML
I have never worked with XML and SOAP envelopes. I am trying to write a generic algorithm to read a flat file and to write the details into a SOAP like XML file. I was thinking of the following approach but want to know if there would be a better approach to do it.

  • Create a file containing the sample XML envelope with variables instead of the actual values
  • Create a properties file which contains a mapping between the variables and the index of the column (containing value for this variable) in the flat file.
  • Read the Flat file line by line in Java Code. Convert the line to an ArrayList based on the columns in the line
  • For each line, I read the sample XML envelope as defined in Step 1 above. I replace the variables in the XML string with the values from the arraylist based on the associated variable index.
  • Write the XML to a file.


  • I can write the xml file by javax.xml.soap.MessageFactory but that would make the mapping complex and would probably take more time to execute.

    Any suggestions on the right approach to achieve this?
    Wink, wink, nudge, nudge, say no more ... https://richsoil.com/cards


    This thread has been viewed 193 times.

    All times above are in ranch (not your local) time.
    The current ranch time is
    Jan 21, 2018 05:57:34.