hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Julius Davies" <juliusdav...@gmail.com>
Subject Re: help!! method not allowed
Date Tue, 13 Mar 2007 04:37:26 GMT
Maybe try POST instead?  It's a lot more common.

PUT is generally only used with WebDAV in my experience.


yours,

Julius


On 3/12/07, mmaulana@permatabank.co.id <mmaulana@permatabank.co.id> wrote:
> Hi....
>
> I have a simple PUT request to https.
>
> But I get the following error.
>
> -----------------------error
> 2007/03/13 10:53:52:271 ICT [DEBUG] HttpClient - Java version: 1.4.2
> 2007/03/13 10:53:52:271 ICT [DEBUG] HttpClient - Java vendor: IBM
> Corporation
> 2007/03/13 10:53:52:287 ICT [DEBUG] HttpClient - Java class path: D:\Source
> Code\Workspace\fileTransferHttps;D:\Source
> Code\Workspace\fileTransferHttps\lib\commons-logging-1.1.jar;D:\Source
> Code\Workspace\fileTransferHttps\lib\commons-codec-1.3.jar;D:\Source
> Code\Workspace\fileTransferHttps\lib\commons-httpclient-3.1-beta1.jar
> 2007/03/13 10:53:52:287 ICT [DEBUG] HttpClient - Operating system name:
> Windows XP
> 2007/03/13 10:53:52:287 ICT [DEBUG] HttpClient - Operating system
> architecture: x86
> 2007/03/13 10:53:52:287 ICT [DEBUG] HttpClient - Operating system version:
> 5.1
> 2007/03/13 10:53:52:755 ICT [DEBUG] HttpClient - IBMJCE 1.2: IBMJCE
> Provider implements the following: HMAC-SHA1, MD2, MD5, MARS, SHA,
> MD2withRSA, MD5withRSA, SHA1withRSA, RSA, SHA1withDSA, RC2, RC4,
> Seal)implements the following:
> Signature algorithms               : SHA1withDSA, SHA1withRSA, MD5withRSA,
> MD2withRSA
> Cipher algorithms                  : Blowfish, AES, DES, TripleDES,
> PBEWithMD2AndDES,
>                                        PBEWithMD2AndTripleDES,
> PBEWithMD2AndRC2,
>                                        PBEWithMD5AndDES,
> PBEWithMD5AndTripleDES,
>                                        PBEWithMD5AndRC2, PBEWithSHA1AndDES
>                                        PBEWithSHA1AndTripleDES,
> PBEWithSHA1AndRC2
>                                        PBEWithSHAAnd40BitRC2,
> PBEWithSHAAnd128BitRC2
>                                        PBEWithSHAAnd40BitRC4,
> PBEWithSHAAnd128BitRC4
>                                        PBEWithSHAAnd2KeyTripleDES,
> PBEWithSHAAnd3KeyTripleDES
>                                        Mars, RC2, RC4,
>                                        RSA, Seal
> Message authentication code (MAC)  : HmacSHA1, HmacMD2, HmacMD5
> Key agreement algorithm            : DiffieHellman
> Key (pair) generator               : Blowfish, DiffieHellman, DSA, AES,
> DES, TripleDES, HmacMD5,
>                                        HmacSHA1, Mars, RC2, RC4, RSA, Seal
> Message digest                     : MD2, MD5, SHA-1, SHA-256, SHA-384,
> SHA-512
> Algorithm parameter generator      : DiffieHellman, DSA
> Algorithm parameter                : Blowfish, DiffieHellman, AES, DES,
> TripleDES, DSA, Mars,
>                                        PBEwithMD5AndDES, RC2
> Key factory                        : DiffieHellman, DSA, RSA
> Secret key factory                 : Blowfish, AES, DES, TripleDES, Mars,
> RC2, RC4, Seal
>                                        PKCS5Key, PBKDF1 and
> PBKDF2(PKCS5Derived Key).
> Certificate                        : X.509
> Secure random                      : IBMSecureRandom
> Key store                          : JCEKS, PKCS12KS (PKCS12), JKS
>
> 2007/03/13 10:53:52:927 ICT [DEBUG] HttpClient - IBMJSSE 1.42: IBM JSSE
> provider
> 2007/03/13 10:53:52:927 ICT [DEBUG] HttpClient - IBMJSSE2 1.42: IBM JSSE
> provider2 (implements IbmX509 key/trust factories, SSLv3, TLSv1)
> 2007/03/13 10:53:52:927 ICT [DEBUG] HttpClient - IBMJGSSProvider 1.01:
> IBMJGSSProvider supports Kerberos V5 Mechanism
> 2007/03/13 10:53:52:927 ICT [DEBUG] HttpClient - IBMCertPath 1.0:
> IBMCertPath Provider implements the following:
> CertificateFactory                : X.509
> CertPathValidator              : PKIX
> CertStore                      : Collection, LDAP
> CertPathBuilder                : PKIX
>
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.useragent = Jakarta Commons-HttpClient/3.1-beta1
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.version = HTTP/1.1
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.connection-manager.class = class
> org.apache.commons.httpclient.SimpleHttpConnectionManager
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.cookie-policy = default
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.element-charset = US-ASCII
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.protocol.content-charset = ISO-8859-1
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.method.retry-handler =
> org.apache.commons.httpclient.DefaultHttpMethodRetryHandler@3b81cb90
> 2007/03/13 10:53:52:943 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.dateparser.patterns = [EEE, dd MMM yyyy HH:mm:ss zzz, EEEE, dd-MMM-yy
> HH:mm:ss zzz, EEE MMM d HH:mm:ss yyyy, EEE, dd-MMM-yyyy HH:mm:ss z, EEE,
> dd-MMM-yyyy HH-mm-ss z, EEE, dd MMM yy HH:mm:ss z, EEE dd-MMM-yyyy HH:mm:ss
> z, EEE dd MMM yyyy HH:mm:ss z, EEE dd-MMM-yyyy HH-mm-ss z, EEE dd-MMM-yy
> HH:mm:ss z, EEE dd MMM yy HH:mm:ss z, EEE,dd-MMM-yy HH:mm:ss z,
> EEE,dd-MMM-yyyy HH:mm:ss z, EEE, dd-MM-yyyy HH:mm:ss z]
> 2007/03/13 10:53:53:021 ICT [DEBUG] DefaultHttpParams - Set parameter
> http.connection.timeout = 8000
> 2007/03/13 10:53:53:068 ICT [DEBUG] HttpConnection - Open connection to
> 10.87.1.173:80
> 2007/03/13 10:53:53:115 ICT [DEBUG] header - >> "CONNECT
> extranet.medcoenergi.com:443 HTTP/1.1"
> 2007/03/13 10:53:53:115 ICT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2007/03/13 10:53:53:115 ICT [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1-beta1[\r][\n]"
> 2007/03/13 10:53:53:115 ICT [DEBUG] header - >> "Host:
> extranet.medcoenergi.com[\r][\n]"
> 2007/03/13 10:53:53:115 ICT [DEBUG] header - >> "Proxy-Connection:
> Keep-Alive[\r][\n]"
> 2007/03/13 10:53:53:115 ICT [DEBUG] header - >> "[\r][\n]"
> 2007/03/13 10:53:53:209 ICT [DEBUG] header - << "HTTP/1.1 200 Connection
> established[\r][\n]"
> 2007/03/13 10:53:53:209 ICT [DEBUG] header - << "Via: 1.1 TW3-PROXY-P03[\r]
> [\n]"
> 2007/03/13 10:53:53:240 ICT [INFO] HttpMethodBase - Response content length
> is not known
> 2007/03/13 10:53:53:240 ICT [DEBUG] HttpMethodBase - Force-close
> connection: true
> 2007/03/13 10:53:53:255 ICT [DEBUG] ConnectMethod - CONNECT status code 200
> 2007/03/13 10:53:53:255 ICT [DEBUG] HttpConnection - Secure tunnel to
> extranet.medcoenergi.com:443
> 2007/03/13 10:53:56:084 ICT [DEBUG] header - >> "PUT
> /permata/DebitCard/Outgoing HTTP/1.1[\r][\n]"
> 2007/03/13 10:53:56:084 ICT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2007/03/13 10:53:56:084 ICT [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1-beta1[\r][\n]"
> 2007/03/13 10:53:56:084 ICT [DEBUG] header - >> "Host:
> extranet.medcoenergi.com[\r][\n]"
> 2007/03/13 10:53:56:099 ICT [DEBUG] header - >> "Content-Length: 6[\r][\n]"
> 2007/03/13 10:53:56:099 ICT [DEBUG] header - >> "[\r][\n]"
> 2007/03/13 10:53:56:381 ICT [DEBUG] EntityEnclosingMethod - Request body
> sent
> 2007/03/13 10:53:56:771 ICT [DEBUG] header - << "HTTP/1.1 401 Access Denied
> [\r][\n]"
> 2007/03/13 10:53:56:771 ICT [DEBUG] header - << "Server: Microsoft-IIS/5.0
> [\r][\n]"
> 2007/03/13 10:53:56:771 ICT [DEBUG] header - << "Date: Tue, 13 Mar 2007
> 03:54:43 GMT[\r][\n]"
> 2007/03/13 10:53:56:787 ICT [DEBUG] header - << "WWW-Authenticate: Basic
> realm="extranet.medcoenergi.com"[\r][\n]"
> 2007/03/13 10:53:56:787 ICT [DEBUG] header - << "Connection: close[\r][\n]"
> 2007/03/13 10:53:56:787 ICT [DEBUG] header - << "Content-Length: 4431[\r]
> [\n]"
> 2007/03/13 10:53:56:787 ICT [DEBUG] header - << "Content-Type: text/html
> [\r][\n]"
> 2007/03/13 10:53:56:787 ICT [DEBUG] HttpMethodDirector - Authorization
> required
> 2007/03/13 10:53:56:803 ICT [DEBUG] AuthChallengeProcessor - Supported
> authentication schemes in the order of preference: [ntlm, digest, basic]
> 2007/03/13 10:53:56:803 ICT [DEBUG] AuthChallengeProcessor - Challenge for
> ntlm authentication scheme not available
> 2007/03/13 10:53:56:803 ICT [DEBUG] AuthChallengeProcessor - Challenge for
> digest authentication scheme not available
> 2007/03/13 10:53:56:803 ICT [INFO] AuthChallengeProcessor - basic
> authentication scheme selected
> 2007/03/13 10:53:56:803 ICT [DEBUG] AuthChallengeProcessor - Using
> authentication scheme: basic
> 2007/03/13 10:53:56:803 ICT [DEBUG] AuthChallengeProcessor - Authorization
> challenge processed
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpMethodDirector - Authentication
> scope: BASIC 'extranet.medcoenergi.com'@extranet.medcoenergi.com:443
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpMethodDirector - Retry
> authentication
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpMethodBase - Should close
> connection in response to directive: close
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpConnection - Connection is locked.
> Call to releaseConnection() ignored.
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpMethodDirector - Authenticating
> with BASIC 'extranet.medcoenergi.com'@extranet.medcoenergi.com:443
> 2007/03/13 10:53:56:803 ICT [DEBUG] HttpMethodParams - Credential charset
> not configured, using HTTP element charset
> 2007/03/13 10:53:56:818 ICT [DEBUG] HttpConnection - Open connection to
> 10.87.1.173:80
> 2007/03/13 10:53:56:818 ICT [DEBUG] header - >> "CONNECT
> extranet.medcoenergi.com:443 HTTP/1.1"
> 2007/03/13 10:53:56:818 ICT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2007/03/13 10:53:56:818 ICT [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1-beta1[\r][\n]"
> 2007/03/13 10:53:56:818 ICT [DEBUG] header - >> "Host:
> extranet.medcoenergi.com[\r][\n]"
> 2007/03/13 10:53:56:818 ICT [DEBUG] header - >> "Proxy-Connection:
> Keep-Alive[\r][\n]"
> 2007/03/13 10:53:56:818 ICT [DEBUG] header - >> "[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - << "HTTP/1.1 200 Connection
> established[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - << "Via: 1.1 TW3-PROXY-P03[\r]
> [\n]"
> 2007/03/13 10:53:57:818 ICT [INFO] HttpMethodBase - Response content length
> is not known
> 2007/03/13 10:53:57:818 ICT [DEBUG] HttpMethodBase - Force-close
> connection: true
> 2007/03/13 10:53:57:818 ICT [DEBUG] ConnectMethod - CONNECT status code 200
> 2007/03/13 10:53:57:818 ICT [DEBUG] HttpConnection - Secure tunnel to
> extranet.medcoenergi.com:443
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "PUT
> /permata/DebitCard/Outgoing HTTP/1.1[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] HttpMethodBase - Adding Host request
> header
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "User-Agent: Jakarta
> Commons-HttpClient/3.1-beta1[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "Content-Length: 6[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "Authorization: Basic
> cGVybWF0YTo0Z2FtcGFuZzVzdXNhaDY=[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "Host:
> extranet.medcoenergi.com[\r][\n]"
> 2007/03/13 10:53:57:818 ICT [DEBUG] header - >> "[\r][\n]"
> 2007/03/13 10:53:58:803 ICT [DEBUG] EntityEnclosingMethod - Request body
> sent
> 2007/03/13 10:53:58:943 ICT [DEBUG] header - << "HTTP/1.1 100 Continue[\r]
> [\n]"
> 2007/03/13 10:53:58:943 ICT [DEBUG] header - << "Server: Microsoft-IIS/5.0
> [\r][\n]"
> 2007/03/13 10:53:58:943 ICT [DEBUG] header - << "Date: Tue, 13 Mar 2007
> 03:54:44 GMT[\r][\n]"
> 2007/03/13 10:53:58:943 ICT [DEBUG] header - << "X-Powered-By: ASP.NET[\r]
> [\n]"
> 2007/03/13 10:53:58:943 ICT [INFO] HttpMethodBase - Discarding unexpected
> response: HTTP/1.1 100 Continue
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "HTTP/1.1 405 Method Not
> Allowed[\r][\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "Server: Microsoft-IIS/5.0
> [\r][\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "Date: Tue, 13 Mar 2007
> 03:54:44 GMT[\r][\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "X-Powered-By: ASP.NET[\r]
> [\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "Connection: close[\r][\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "Content-Type: text/html
> [\r][\n]"
> 2007/03/13 10:53:59:068 ICT [DEBUG] header - << "Content-Length: 3923[\r]
> [\n]"
> statusLine>>>HTTP/1.1 405 Method Not Allowed
> 2007/03/13 10:54:00:037 ICT [DEBUG] HttpMethodBase - Should close
> connection in response to directive: close
> 2007/03/13 10:54:00:037 ICT [DEBUG] HttpConnection - Releasing connection
> back to connection manager.
> -----------------------
>
> code
> ---------------
>
> import java.io.File;
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.IOException;
> import java.util.Enumeration;
> import org.apache.commons.httpclient.HttpClient;
> import org.apache.commons.httpclient.HttpException;
> import org.apache.commons.httpclient.HttpState;
> import org.apache.commons.httpclient.UsernamePasswordCredentials;
> import org.apache.commons.httpclient.auth.AuthScope;
> import org.apache.commons.httpclient.cookie.CookiePolicy;
> import org.apache.commons.httpclient.methods.OptionsMethod;
> import org.apache.commons.httpclient.methods.PostMethod;
> import org.apache.commons.httpclient.methods.PutMethod;
> import org.apache.commons.httpclient.protocol.Protocol;
>
> public class tesPostSSL {
>
>     public static void main(String[] args) {
>
>
>         System.setProperty("org.apache.commons.logging.Log",
> "org.apache.commons.logging.impl.SimpleLog");
>         System.setProperty
> ("org.apache.commons.logging.simplelog.showdatetime", "true");
>         System.setProperty
> ("org.apache.commons.logging.simplelog.log.httpclient.wire.header",
> "debug");
>         System.setProperty
> ("org.apache.commons.logging.simplelog.log.org.apache.commons.httpclient",
> "debug");
>
>         String url ="https://somesite/Outgoing";
>
>         //https
>         Protocol easyhttps = new Protocol("https", new
> EasySSLProtocolSocketFactory(), 443);
>         Protocol.registerProtocol("https", easyhttps);
>
>         HttpClient client = new HttpClient();
>         //proxy
>         client.getHostConfiguration().setProxy("xx.xx.xx.xxx", 80);
>         //auth
>         client.getState().setCredentials(
>                 new AuthScope("somesite.com", 443, "somesite.com"),
>                 new UsernamePasswordCredentials("userid", "password")
>             );
>
>         PutMethod put = new PutMethod(url);
>
>         client.setConnectionTimeout(8000);
>
>         // Send any XML file as the body of the POST request
>         File f = new File("tes.txt");
>
>         try {
>             put.setRequestBody(new FileInputStream(f));
>         } catch (FileNotFoundException e) {
>             e.printStackTrace();
>         }
>
>         try {
>             int statusCode1 = client.executeMethod(put);
>         } catch (HttpException e1) {
>             e1.printStackTrace();
>         } catch (IOException e1) {
>             e1.printStackTrace();
>         }
>
>         System.out.println("statusLine>>>" + put.getStatusLine());
>         put.releaseConnection();
>     }
> }
> -------------------------------------------------------------------------
>
> Can anyone help?
>
>
> Best Regards,
> M Irvan Maulana
>
>
>
> The contents of this e-mail and attachments are confidential and subject to legal privilege.
If you are not the intended recipient, you are strictly prohibited and may be unlawful to
use, copy, store, distribute, disclose or communicate any part of it to others and you are
obliged to return it immediately to sender or notify us and delete the e-mail and any attachments
from your system. PT BANK PERMATA TBK and subsidiaries do not accept liability for loss or
damage resulting from computer viruses. The integrity of e-mail across the internet cannot
be guaranteed and PT BANK PERMATA TBK will not accept liability for any claims arising as
a result of the use of this medium for transmissions by or to PT BANK PERMATA TBK.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
>
>


-- 
yours,

Julius Davies
416-652-0183
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


Mime
View raw message