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

  • Home
  • SEARCH
  • 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 9273639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:09:41+00:00 2026-06-18T16:09:41+00:00

I want to call my REST service on the client side (GWT) using RequestBuilder.

  • 0

I want to call my REST service on the client side (GWT) using RequestBuilder. I need to serialize a complex type (Connexion), i chose Piriti. The serialization seems to work fine.
Then i attach the string representation of my complex object to the body’s request and send the POST request.

But i have the following error :

org.jboss.resteasy.spi.BadRequestException: Could not find message body reader for type: class com.ald.projet.property.Connexion of content type: application/x-www-form-urlencoded

I use RESTeasy on the server-side, it seems that it doesn’t receive the correct content type.

I checked with firebug, the content type of my request is application/xml …not application/x-www-form-urlencoded

Request headers
 Host: 127.0.0.1:8888
 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0
 Accept: application/xml
 Accept-Language: fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3
 Accept-Encoding: gzip, deflate
 Connection: keep-alive
 Referer: http://127.0.0.1:8888/Front_End.html?gwt.codesvr=127.0.0.1:9997
 Content-Type: application/xml; charset=UTF-8
 Content-Length: 109
 Pragma: no-cache
 Cache-Control: no-cache

Response headers
  Content-Type: text/html; charset=iso-8859-1
  Server  Jetty(6.1.x)

POST content

<connexion>
  <login>azerty</login>
  <password>azerty</password>
</connexion>

Client-side

    Connexion connexion = new Connexion("azerty", "azerty");

    String url ="proxy.jsp?url=" + URL.encode("http://localhost:8080/rest/service/connexion");
    RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url);

    builder.setHeader("Content-Type", "application/xml");
    builder.setHeader("Accept", "application/xml"); 

    //serialization with Piriti     
    String xml = Connexion.WRITER.toXml(connexion);
    builder.setRequestData(xml);

    builder.setCallback(new RequestCallback() {

        @Override
        public void onResponseReceived(Request request, Response response) {
            GWT.log(response.getText());
            System.out.println(response.getText().trim());
        }

        @Override
        public void onError(Request request, Throwable exception) {
        }
    });

    try{
        builder.send();
    }catch(Exception e){
        e.printStackTrace();
    }
}

Rest Service (server side)

@POST
@Path("/connexion")
//@Consumes("application/xml")
@Produces("application/xml")
public Response connexion(Connexion connexion){
    String status = connexionDAO.isValidConnection(connexion);
    
    return Response.ok(status).build();
    
}

Connexion.java client side

public class Connexion {

interface ConnexionReader extends XmlReader<Connexion> {}
public static final ConnexionReader XML = GWT.create(ConnexionReader.class);


public interface ConnexionWriter extends XmlWriter<Connexion> {}
public static final ConnexionWriter WRITER = GWT.create(ConnexionWriter.class);


private String login;
private String password;

public Connexion(){
    
}


public Connexion(String login, String password) {
    super();
    this.login = login;
    this.password = password;
}
public String getLogin() {
    return login;
}
public void setLogin(String login) {
    this.login = login;
}
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}   

}

Connexion.java server side

@Embeddable
@XmlRootElement(name = "connexion")
public class Connexion {

private String login;
private String password;

public Connexion(){
    
}

public Connexion(String login, String password) {
    super();
    this.login = login;
    this.password = password;
}

@XmlElement
public String getLogin() {
    return login;
}
public void setLogin(String login) {
    this.login = login;
}

@XmlElement
public String getPassword() {
    return password;
}
public void setPassword(String password) {
    this.password = password;
}   

}

what is happening and what can i do in order to make it work ?

Thx in advance

  • 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-18T16:09:43+00:00Added an answer on June 18, 2026 at 4:09 pm

    In fact my proxy was modifying the content of my request.

    I deployed my GWT application on Jetty (back-end) and that solved it, it lasts only one server so i don’t have SOP issue.
    No need to use some proxy anymore, but every time i change something in the client side i have to re deploy it and it’s a loss of time.

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

Sidebar

Related Questions

I want to test my REST-Service using the RestEasy Client Framework. In my application
I want to make a XHR call to a REST service using the ajax()
I want to build a client for my REST-Service using Knockout.js. I have a
I want to consume a WCF REST service using an AJAX call. Suppose I
I'm using the Jersey Client library to run tests against a rest service running
I want to call a rest webservice with POST method.Below is the service url
I want to call a rest service written in WCF (which can support both
Given optimistic concurrency using a version property and a json rest-service with a client
I'm using the ChannelFactory in WCF to call into a REST service and I
I want to call a webservice using google closures, via jsonp since i am

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.