I am trying to do SOAP Web Service Automation, I figured out an Exception while executing. java.io.FileNotFoundException was thrown when i tried to run/debug, I also found that the response code that I received was 404. I am using a JKS format keystore for security.
Code:
HttpURLConnection httpConnection = null;
String strResponse = null;
java.net.URL url = new URL(strURL);
if (url.getProtocol().equalsIgnoreCase("http")) {
httpConnection = (HttpURLConnection) url.openConnection();
}
httpConnection.setDoOutput(true);
httpConnection.setDoInput(true);
httpConnection.setRequestMethod("POST");
OutputStreamWriter writer = new OutputStreamWriter(httpConnection.getOutputStream());
writer.write(wsRequestString);
writer.close();
System.out.println(httpConnection.getResponseCode());
if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
System.out.println(httpConnection.getInputStream());
}
When I am trying to execute httpConnection.getInputStream(), it throws java.io.FileNotFoundException. Also the URL I am sending as parameter is also a valid one. what could be the possible reason for this exception?