I need to send a xml request from a java standalone class. The xml request that I need to send is of the form -
http://url/query.do?
Request=<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Request initialTime="2011-03-11T16:40Z">
<Query>Java</Query></Request>
So i have put in
String xmlRequest = "url/query.do? Request=<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Request initialQueryTime="2011-03-11T16:40Z"> <Query>Java</Query></Request>"
and then
URL url = new URL(xmlRequest);
URLConnection conn = (URLConnection)url.openConnection();
//conn.connect();
BufferedReader in = new BufferedReader(
new InputStreamReader(
conn.getInputStream()));
But I am getting a IOException - Server returned HTTP response code: 505 for URL at sun.net.www.protocol.http.HttpURLConnection.getInputStream.
This url when hit through a browser returns a xml response and I need to parse that XML using STAX.
Can anyone please provide some idea on how to achieve the above.
Can someone please provide some sample code or correct my code so that I am able to form the xml request and parse the xml response. Please help.
Thanks,
swati