I am reading data from a webservice. The issue if I put the link on the browser it works fine. When I run like this give me error. I am suspecting is it due to the way how I send my parameters. My paramater list has this dID=1,5,7,11,14,18,26&FromDate=18 Sep 2012 00:00 am&ToDate=18 Sep 2012 10:00 am
. Do I need to do some encoding here?
URL xmlURLDM = new URL(urlDM);
InputStream xml2 = xmlURLDM.openStream();
I get this error
java.io.IOException: Server returned HTTP response code: 400 for URL:
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1612)
at java.net.URL.openStream(URL.java:1035)
at xmlreader.main(xmlreader.java:172)
Paul Jowett :
You do need encoding, most likley it is the spaces in your URL that is causing the trouble.\nUse Javas built in url-encoding. eg:\n\nString encoded = URLEncoder.encode(myUrl, \"UTF-8\");\n\n\n...\n call web service with encoded as URL\n\nThere can be other reasons for the status code being 400, but this encoding issue is probably your first stumbling block.",
2012-09-18T03:57:44