Results 1 to 2 of 2

Thread: Spring bean as REST client

  1. #1
    Join Date
    Sep 2010
    Posts
    16

    Default Spring bean as REST client

    Hi,

    I'm new to spring and working with some existing REST client code. The code successfully calls an outside REST web service by passing it a json request string and receiving a json response string

    Code:
    String resp = client.postForObject( serviceUrl, jsonRequestString, String.class );
    and I catch RestClientException that might result from this call.

    What happens to the HTTP response and other header information? Is there a different call through which I can get the entire HTTP response? Something like this pseudocode:

    HttpRequest httpReq = new HttpRequest(jsonRequestString);
    HttpResponse httpResp = client.makeHttpCall(serviceUrl, httpReq);
    HttpResponseCode = httpResp.getCode();
    String resp = httpResp.getBody();
    ...

    Thanks.

  2. #2

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •