• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to dynamically generate then POST xml data?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm new to XML and need to create a web app needs to do the following:
1. Read a couple of parameters (username and password) from the request
2. Dynamically create some xml code with those params
3. Send the xml code to another web service for validation

I am struggling with steps 2 and 3. Have been reading a lot on XML and SAX but the possible solutions I'm looking at seem really heavy. Is there a simple / straightforward way of doing what I need? Any code samples/snippets would be much appreciated.

Cheers,
James
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The simplest thing to do is just treat this as a problem in generating text and ignore the XML APIs.

If you can create/edit a text file that is a legal XML document containing example data, use that as a template and fill in the changing values at runtime.

I did this as a quick fix for a customer, so very very much simpler and faster than creating a DOM in memory and serializing it.

Another possibility would be to use JAXB .

Bill

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic