原因 axis客户端访问webservice默认是使用http1.0版本的,这个版本的http不能保持长连接,应该换成http1.1版本
具体修改步骤:
<?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>
上述文件具体的替换内容如下:
将
<transport name="http"
pivot="java:org.apache.axis.transport.http.HTTPSender" />
替换为
<transport name="http"
pivot="java:org.apache.axis.transport.http.CommonsHTTPSender" />
HTTPSender使用HTTP1.0,修改为CommonsHTTPSender使用httpclient发送请求,使用的是HTTP1.1。
由于使用了HTTPCLIENT,请导入依赖包:commons-httpclient-3.1.jar和commons-codec-1.3.jar。
pom.xml增加
<!-- 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/17300067