• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Flat File to SOAP XML

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic