Announcement Announcement Module
Collapse
No announcement yet.
Spring bean as REST client Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    Have you taken a look at http://static.springsource.org/sprin...nseEntity.html ?

    Comment

    Working...
    X