You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by rr...@apache.org on 2010/06/30 23:45:54 UTC
svn commit: r959448 -
/ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java
Author: rr
Date: Wed Jun 30 21:45:54 2010
New Revision: 959448
URL: http://svn.apache.org/viewvc?rev=959448&view=rev
Log:
Shutdown http connection manager after sending request
Modified:
ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java
Modified: ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java
URL: http://svn.apache.org/viewvc/ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java?rev=959448&r1=959447&r2=959448&view=diff
==============================================================================
--- ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java (original)
+++ ode/trunk/tools/src/main/java/org/apache/ode/tools/sendsoap/cline/HttpSoapSender.java Wed Jun 30 21:45:54 2010
@@ -108,21 +108,25 @@ public class HttpSoapSender extends Base
}
m.appendTail(sb);
SimpleHttpConnectionManager mgr = new SimpleHttpConnectionManager();
- mgr.getParams().setConnectionTimeout(60000);
- mgr.getParams().setSoTimeout(60000);
- HttpClient httpClient = new HttpClient(mgr);
- PostMethod httpPostMethod = new PostMethod(u.toExternalForm());
- if (proxyServer != null && proxyServer.length() > 0) {
- httpClient.getState().setCredentials(new AuthScope(proxyServer, proxyPort),
- new UsernamePasswordCredentials(username, password));
- httpPostMethod.setDoAuthentication(true);
- }
- if (soapAction == null) soapAction = "";
- httpPostMethod.setRequestHeader("SOAPAction", "\"" + soapAction + "\"");
- httpPostMethod.setRequestHeader("Content-Type", "text/xml");
- httpPostMethod.setRequestEntity(new StringRequestEntity(sb.toString()));
- httpClient.executeMethod(httpPostMethod);
- return httpPostMethod.getResponseBodyAsString() + "\n";
+ try {
+ mgr.getParams().setConnectionTimeout(60000);
+ mgr.getParams().setSoTimeout(60000);
+ HttpClient httpClient = new HttpClient(mgr);
+ PostMethod httpPostMethod = new PostMethod(u.toExternalForm());
+ if (proxyServer != null && proxyServer.length() > 0) {
+ httpClient.getState().setCredentials(new AuthScope(proxyServer, proxyPort),
+ new UsernamePasswordCredentials(username, password));
+ httpPostMethod.setDoAuthentication(true);
+ }
+ if (soapAction == null) soapAction = "";
+ httpPostMethod.setRequestHeader("SOAPAction", "\"" + soapAction + "\"");
+ httpPostMethod.setRequestHeader("Content-Type", "text/xml");
+ httpPostMethod.setRequestEntity(new StringRequestEntity(sb.toString()));
+ httpClient.executeMethod(httpPostMethod);
+ return httpPostMethod.getResponseBodyAsString() + "\n";
+ } finally {
+ mgr.shutdown();
+ }
}
public static void main(String[] argv) {