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 8012803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:26:37+00:00 2026-06-04T19:26:37+00:00

Getting an error while trying to consume a Restful web service using POST method(with

  • 0

Getting an error while trying to consume a Restful web service using
POST method(with form param).

I want to consume a REST application using POST method.
Please find below the resource class I want to access.

@Path("/user")

public class User {

@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response get(@FormParam("username") String userName,
        @FormParam("userid") String userId  ){

}

I tried using Jesry Client for accessing.Please find below the code i tried.
I tried adding values to FormParam as shown below.

Trail 1

WebResource webResource = client.resource("baseURL/user");

String input = "userid:1001,username:demo1";
ClientResponse response = webResource.type("application/x-www-form-urlencoded").post(ClientResponse.class, input);

I am getting a an error response back “The server encountered an internal error () that prevented it from fulfilling this request”.
I think I am not adding the values to FormParam properly.

Trial 2

I also tried adding the form params using the below code

MultivaluedMap formData = new MultivaluedMapImpl();
    formData.add("userid", "1001");
    formData.add("username", "demo1");
    ClientResponse response = webResource.type("application/x-www-form-urlencoded").post(ClientResponse.class, formData);

This also resulted in the same error.

Trial 3

Form f = new Form();
    f.add("userid", "1001D");
    f.add("username", "1001D");

    ClientResponse response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(ClientResponse.class, f);

This also resulted in the same error.
Any help is appreciated.

  • 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-04T19:26:39+00:00Added an answer on June 4, 2026 at 7:26 pm

    Since your error indicates “Server encountered an internal error” you need to look at the server (logs) to see what went wrong. Certainly your 3rd client looks fine to reach the service you defined (assuming you are using something real instead of the string “baseURL”).

    You can easily test your server is working separately from your client by creating a HTML page to reach the service. Create a HTML form using enctype=”application/x-www-form-urlencoded” and posting to your service endpoint (what you are calling “baseURL/user”) with form parameters userid and username. When you view the HTML form in a browser and hit the submit button, it will call your server – if you get the same error you can be sure it is nothing to do with your client code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error while trying to post data to a hosted web application
I'am getting an error while trying to send email using StmpClient. Error: Mailbox unavailable.
I am getting this error while trying to connect my web site. Unspecified error
I'm trying to consume an IBM DataPower web service in WCF getting the following
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I am getting an error while trying to run CFmx code on a remote
I'm getting an error while trying to use the action_mailer_tls plugin to communicate with
I keep getting this error while trying to modify some tables. Here's my code:
I'm new to AS3 and I'm getting this error while trying to implement OO
I'm getting follwing error while I'm trying to filter data for the second time

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.