[prev in list] [next in list] [prev in thread] [next in thread]
List: wink-user
Subject: Apache Wink REST Client - Connection Reset
From: "Dave Westerman" <dlwester () us ! ibm ! com>
Date: 2017-04-11 22:05:19
Message-ID: OFABB77406.BA73AD33-ON002580FF.007936F9-002580FF.0079564F () notes ! na ! collabserv ! com
[Download RAW message or body]
<font face="Verdana,Arial,Helvetica,sans-serif" size="2"><span>I am using the Apache Wink REST Client in my Java EE application running in WebSphere Liberty Profile to call external services. There are two separate services that I need to call. Calls to the first service always works. <br> <br>Calls to the second service only work once, and from then on I always get a "Connection reset" error unless I recycle my WLP server. The only difference I see between the one that works and the one that doesn't, is that the failing one has the 'Connection: Keep-Alive' header in the response. <br> <br>Could the Keep-Alive be causing the issue? Is there some way to handle or override that from the REST client? I have all the Wink REST client code in one method, and it never reuses any of the objects such as RestClient, Resource, ClientResponse, etc. - I always get new objects every time. <br> <br> ClientResponse clientResponse = null;<br> try {<br> clientResponse = executeRestClientGet(serviceUrlPath, headers, mgrId);<br> int statusCode = clientResponse.getStatusCode();<br> String jsonString;<br> if (statusCode == Response.Status.OK.getStatusCode()) {<br> jsonString = clientResponse.getEntity(String.class);<br> try {<br> result = (JSONObject) JSON.parse(jsonString);<br> } catch (JSONException exc) {<br> ...<br> }<br> } else {<br> ...<br> }<br> <br> private static ClientResponse executeRestClientGet(String serviceUrlPath, HashMap<String, String> headers,<br> String mgrId) {<br> ClientResponse clientResponse = null;<br> try {<br> RestClient restClient = new RestClient();<br> Resource resource = restClient.resource(serviceUrlPath);<br> addHeadersToResource(resource, headers, null);<br> clientResponse = resource.get();<br> } catch (Exception exc) {<br> ...<br> }<br> return clientResponse;<br> }<br><br></span></font><BR>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic