Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8551295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:09:56+00:00 2026-06-11T14:09:56+00:00

I keep receiving a 406 HTTP response when I try to execute code structured

  • 0

I keep receiving a 406 HTTP response when I try to execute code structured in this way. I have tried restructuring the code and the inputs many times, but I still receive this error, and I’ve gotten to the point I don’t even really know what to debug. The exception seems to indicate that the post() method isn’t supplying the @FormParams in the desired format, but as you can see the .accept(MediaType.APPLICATION_FORM_URLENCODED) and the @Consumes(MediaType.APPLICATION_FORM_URLENCODED) do indeed match up.

I am using the Firefox add-on HTTPRequester to pass in the @FormParams and have ensured that I am passing them in with the appropriate Content-Type (application/x-www-form-urlencoded). I’ve run out of things to check. Does anyone have any ideas?


The Proxy Service

Client client = Client.create();
WebResource service = client.resource(myURL);

Form form = new Form();
form.add("value1", value1);
form.add("value2", value2);
form.add("valueN", valueN);

String returnValue = service.accept(MediaType.APPLICATION_FORM_URLENCODED).post(String.class, form);

The Actual Service

@POST
@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Path("/theService")
public String theService(
        @FormParam("value1") String value1,
        @FormParam("value2") String value2,
        @FormParam("valueN") String valueN) {

    String returnValue = null;

    /*
     * Do Stuff
     */

    return returnValue;
}

The Exception

com.sun.jersey.api.client.UniformInterfaceException: POST http://theURL/theService returned a response status of 406
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:563)
at com.sun.jersey.api.client.WebResource.access$300(WebResource.java:69)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:499)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:09:57+00:00Added an answer on June 11, 2026 at 2:09 pm

    UniformInterfaceException is just a catch-all exception with a poor name (it’s named this because it’s an exception that provides a uniform interface, no matter the error). It’s basically an IOException thrown by anything in Jersey. The actual error is the 406 Unacceptable:

    The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request.

    Here you’re saying that you accept MediaType.APPLICATION_FORM_URLENCODED:

    String returnValue = service.accept(MediaType.APPLICATION_FORM_URLENCODED).post(String.class, form);
    

    But your service produces MediaType.APPLICATION_XML:

    @Produces(MediaType.APPLICATION_XML)
    

    Since your server can’t produce any content that the client says it will accept, it returns a 406 error.

    Most likely, you’re meaning to set WebResource.type, not accept:

    String returnValue = service.type(MediaType.APPLICATION_FORM_URLENCODED).post(String.class, form);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to javascript/jquery. I have the following basic code and I keep receiving
I keep receiving this error... [2012-06-14 11:54:50,072: ERROR/MainProcess] Hard time limit (300s) exceeded for
Keep going around circles, but I am still unclear about this. Have a feeling
I can't find out what the problem is, and why I keep receiving this
I'm trying to mock MouseButtonEventArgs.GetPosition() with Moq, but I keep receiving this error: System.ArgumentException:
I am keep receiving this error on my magento pages in frontend and back-end.
I keep receiving the error Thread 1 EXEC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0xf286) my project is in
I keep receiving the deprecated header warning: #ifdef __DEPRECATED #warning This file includes at
I keep receiving a long string of errors when I try to declare a
I keep receiving several error messages (currently 35) when I try to compile FreeImageNET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.