• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting error while posting HTTPS POST method

 
Abhijit Kumbhar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Every1,
I am getting error while posting post request in html.

The error is.
***************************************
POST
Resp Code:405
Resp Message:Method not allowed

***************************************
I am using Https IIS server. if you knows about this then please suggest me.. condition is i can,t use another server (specification)

Regards,
Abhijit


PLEASE VIEW CODE ALSO IF POSSIBLE..

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package com.https;

import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;

/**
*
* @author Administrator
*/
public class MyHttpsPOSTClass
{
public static void main(String args[])
{
try
{
URL url = new URL("https://localhost/a.pdf");
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod("POST");
System.out.println(connection.getRequestMethod());
HttpsURLConnection.setFollowRedirects(true);
int i;
FileInputStream fin = new FileInputStream("C://Https Download/anyfile.txt");
DataOutputStream output = new DataOutputStream( connection.getOutputStream() );
do
{
i = fin.read();
if (i != -1)
output.writeInt(i);
}while (i != -1);
output.close();

fin.close();

System.out.println("Resp Code:"+connection.getResponseCode());
System.out.println("Resp Message:"+ connection.getResponseMessage());

} catch (Exception ex)
{
System.out.println(ex);
}
}
}


 
Henry Wong
author
Marshal
Pie
Posts: 21016
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abhijit Kumbhar wrote:
The error is.
***************************************
POST
Resp Code:405
Resp Message:Method not allowed



Error code 405 means that the access method is not allowed -- exactly described in the error message. This means that your web server is not allowing post requests. You need to change the configuration on your web server to allow post requests.

Henry
 
Abhijit Kumbhar
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all and Henry,
My IIS 5.1 HTTPS Server not responding POST method after setting its GET,POST verb in (Default Website>Configuration>set POST ,GET etc.)
If any one know about this error then suggest me once.

Regards
Abhijit
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic