Suresh Raja
Suresh Raja

Reputation: 31

How to get xml file over http?

A xml file with data will be sent over http to server my job is to get that xml file and parse it using web service and I am using Netbeans 6.9. How can i get that xml file can anyone tell me ?

Upvotes: 1

Views: 3459

Answers (3)

prashant thakre
prashant thakre

Reputation: 5147

Use HttpClient for the same to recieve the XML , After recieving the xml use JAXB/XMLbeans parser to parse the xml. You must have to sure about xml's xsd before parsing the same. If already you are having xsd against the incoming xml then just created the classes by using using any above mentioned tool.

Upvotes: 0

phildrip
phildrip

Reputation: 134

Assuming you're responsible for writing the service using servlets and the xml file will be POSTed to the server, you can access it using HttpServletRequest.getParameter(paramName).

Upvotes: 0

jcuenod
jcuenod

Reputation: 58375

Looking for something like this?

URL xmlUrl = new URL("http://www.rekindle.co.za/rss.xml");
InputStream in = xmlUrl.openStream();
Document doc = parse(in);

Taken from a similar question about parsing at http://www.java-forums.org/xml/22674-get-xml-data-url.html

Upvotes: 1

Related Questions