• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Getting error while posting HTTPS POST method

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
}
}
}


 
author
Posts: 23907
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic