CrazyEngineers
  • Hi guys,

    Projects initial requirements is to create a client to communicate with a REST web service server(remote server) using jersey,

    i want to create a CLIENT REQUEST HEADER which contains following parameters in same order.

    Request PATTERN:

    1)GET(method)
    2)URL domain(remote)
    3)URL path
    4)date field(date and time)
    5)access key(public key)
    6)accept field(application/xml or application/json)

    amateur code:

    Client client = Client.create();
    WebResource webResource =client.resource(url);

    ClientResponse response = webResource.queryParam("Date", timeStamp+" GMT")
    .header("Authorization", requestAuthKey)
    .accept(MediaType.APPLICATION_XML_TYPE)
    .get(ClientResponse.class);


    😀
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Manish Goyal

    MemberFeb 10, 2014

    A very nice explanation for your Problem.

    #-Link-Snipped-#

    I don't know anything about this language, but it is clear you are passing request parameters in incorrect way
    Are you sure? This action cannot be undone.
    Cancel
  • micheal john

    MemberFeb 10, 2014

    Manish Goyal
    A very nice explanation for your Problem.

    #-Link-Snipped-#

    I don't know anything about this language, but it is clear you are passing request parameters in incorrect way
    MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl();
    queryParams.add("q", "stuff"); //set parametes for request
    Client client = Client.create(config);
    client.addFilter(new LoggingFilter(System.out));
    WebResource webResource =client.resource(url);
    com.sun.jersey.api.client.WebResource.Builder builder = webResource
    .queryParams(queryParams).header("x-date", timeStamp+" GMT")
    .header("Authorization", requestAuthKey)
    .accept(MediaType.APPLICATION_XML);

    for this i'm getting 500 "internal server error"
    Are you sure? This action cannot be undone.
    Cancel
  • micheal john

    MemberFeb 10, 2014

    eclipse_console
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberFeb 11, 2014

    Try to turn on debug level, it will show you actual error,
    Are you sure? This action cannot be undone.
    Cancel
  • micheal john

    MemberFeb 12, 2014

    @#-Link-Snipped-#, i tried debbuging for 2 long days and now i arrived at solution.

    problem was my machine time was not synchronized with the server.

    thanks you
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberFeb 12, 2014

    Good to hear that, Please share what did you learn from this problem, I mean How did you find this problem that it is something related to sync time between machine time
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register