下面是我们用来调用Microsoft Dynamics的代码。我想知道这段代码可以创建多少个并行连接,或者它可以发送多少个并行请求。
HttpClient client = new HttpClient();
client.getParams().setParameter(CredentialsProvider.PROVIDER, new ConsoleAuthPrompter(logger));
String strURL = getstringURL();
String strSoapAction = "";
strSoapAction = getSoapAction();
PostMethod httppost = new PostMethod(strURL);
String ContetType = getContentType();
RequestEntity entity = new StringRequestEntity(getSOAPxml(),"application/json", "utf-8");
httppost.setRequestEntity(entity);
httppost.setRequestHeader("SOAPAction", strSoapAction);
httppost.setDoAuthentication(true);
try {
// execute the GET
int status = client.executeMethod(httppost);
if (httppost.getStatusCode() == 200)
setReply_SOAPxml(httppost.getResponseBodyAsString());
else {
logger.error("Server Replied with Error :"
+ httppost.getStatusCode() + " "
+ httppost.getStatusText() + " "
+ httppost.getResponseBodyAsString());
throw new Exception("Server Replied with Error : ["
+ httppost.getStatusLine().toString() + "] "
+ httppost.getStatusCode() + " "
+ httppost.getStatusText() + " "
+ httppost.getResponseBodyAsString());
}
} finally {
// release any connection resources used by the method
httppost.releaseConnection();
}
}