緣由 axis客戶端訪問webservice默認是使用http1.0版本的,這個版本的http不能保持長鏈接,應該換成http1.1版本java
具體修改步驟:web
<?xml version="1.0" encoding="UTF-8"?> <deployment name="defaultClientConfig" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <globalConfiguration> <parameter name="disablePrettyXML" value="true"/> <parameter name="enableNamespacePrefixOptimization" value="false"/> </globalConfiguration> <transport name="http" pivot="java:org.apache.axis.transport.http.CommonsHTTPSender" /> <transport name="local" pivot="java:org.apache.axis.transport.local.LocalSender"/> <transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/> </deployment>
上述文件具體的替換內容以下:apache
將tomcat
<transport name="http"
pivot="java:org.apache.axis.transport.http.HTTPSender" />
替換爲ide
<transport name="http"
pivot="java:org.apache.axis.transport.http.CommonsHTTPSender" />
HTTPSender使用HTTP1.0,修改成CommonsHTTPSender使用httpclient發送請求,使用的是HTTP1.1。spa
因爲使用了HTTPCLIENT,請導入依賴包:commons-httpclient-3.1.jar和commons-codec-1.3.jar。.net
pom.xml增長code
<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient --> <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactId> <version>3.1</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec --> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.3</version> </dependency>
原文地址:https://blog.csdn.net/tomatotomcat/article/details/17300067xml