I'm while using apache library. I've produced a category which transmits a publish request to some servlet. I've setup the parameters for that client and that i have produced a HTTP publish resist be sent but for whatever reason after i excute the request i recieve a reposnse that states the get technique is not supported(that is true cause i've only designed a dopost method during my servlet). It appears that the get request has been sent however i have no idea why. The publish method labored before however i began gettng http error 417 "Expectation Unsuccessful" because of me not setting the protocal version however i fixed this with the addition of paramenters.

below is my class in which you visit a HTTPpost object being produced and exectued. I've got a response handler method however i required it of my code below since it is not related to my problem.

I understand a HTTP GET has been sent due to the reponse mesage that's came back states. The required HTTP technique is not permitted for that asked for resource (HTTP method GET isn't based on this URL).

Thanks ahead of time.

P.s i'm developing for android.

public class HTTPrequestHelper {

private final ResponseHandler<String> responseHandler;
private static final String CLASSTAG = HTTPrequestHelper.class.getSimpleName();
private static final DefaultHttpClient client;

    HttpParams params = new BasicHttpParams();      
      params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_1);
      params.setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, HTTP.UTF_8);
      ///params.setParameter(CoreProtocolPNames.USER_AGENT, "Android-x");      
      params.setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 15000);
      params.setParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK, false);

      SchemeRegistry schemeRegistry = new SchemeRegistry();
               new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));

               new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));

      ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(params, schemeRegistry);

      client = new DefaultHttpClient(cm,params);   


public HTTPrequestHelper(ResponseHandler<String> responseHandler) {
this.responseHandler = responseHandler;

public void performrequest(String url, String para)

    HttpPost post = new HttpPost(url);

    StringEntity parameters;
    try {

        parameters = new StringEntity(para);

    } catch (UnsupportedEncodingException e) {
        // TODO Auto-generated catch block

    BasicHttpResponse errorResponse =
        new BasicHttpResponse(
        new ProtocolVersion("HTTP_ERROR", 1, 1),
        500, "ERROR");

    try {

        client.execute(post, this.responseHandler);
    catch (Exception e) {
    try {
    catch (Exception ex) {
             Log.e( "ouch", "!!! IOException " + ex.getMessage() );


I attempted added the allow header towards the request but that didn't act as well but i am not confident that i had been doing right. below may be the code.

client.addRequestInterceptor(new HttpRequestInterceptor() {
            public void process(HttpRequest request, HttpContext context)
                    throws HttpException, IOException {
                //request.addHeader("Allow", "POST");

  1. How are you aware that the HTTP GET is really being sent? Analyzing the http packets sent because of your client or received through the server could be useful here
  2. You catch and swallow UnsupportedEncodingException when creating the Post's parameters - what goes on should you encounter this exception while setting parameters? Your code out of the box today will still make an effort to execute the POST.