做了个jsp程序调用webservice来接受数据,循环几次后就报Connect Reset错误,有没有大侠帮着解决一下呀?折腾好长时间了。
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(ftpaddress));
call.setOperationName(new QName("http://tempuri.org/", "getRecordList"));//WSDL里面描述的接口名称
call.addParameter(new QName("http://tempuri.org/", "username"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//用户名
call.addParameter(new QName("http://tempuri.org/", "password"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//密码
call.addParameter(new QName("http://tempuri.org/", "pageSize"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//一页简历数量
call.addParameter(new QName("http://tempuri.org/", "currentPage"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.addParameter(new QName("http://tempuri.org/", "beginDate"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.addParameter(new QName("http://tempuri.org/", "endDate"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型 call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/GetResumeByJobIDAndDate");String[] obj = new String[]{"user1","testuser1","20","1","2011-01-01","2011-01-10"};
String result = (String)call.invoke(obj);
Service service = new Service();
Call call = (Call)service.createCall();
call.setTargetEndpointAddress(new java.net.URL(ftpaddress));
call.setOperationName(new QName("http://tempuri.org/", "getRecordList"));//WSDL里面描述的接口名称
call.addParameter(new QName("http://tempuri.org/", "username"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//用户名
call.addParameter(new QName("http://tempuri.org/", "password"), org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);//密码
call.addParameter(new QName("http://tempuri.org/", "pageSize"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//一页简历数量
call.addParameter(new QName("http://tempuri.org/", "currentPage"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.addParameter(new QName("http://tempuri.org/", "beginDate"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.addParameter(new QName("http://tempuri.org/", "endDate"), org.apache.axis.encoding.XMLType.XSD_INT,javax.xml.rpc.ParameterMode.IN);//当前页
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);//设置返回类型 call.setUseSOAPAction(true);
call.setSOAPActionURI("http://tempuri.org/GetResumeByJobIDAndDate");String[] obj = new String[]{"user1","testuser1","20","1","2011-01-01","2011-01-10"};
String result = (String)call.invoke(obj);
另外一种情况:
在项目的web.xml里<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <servlet> <servlet-name>XFireServlet</servlet-name>
<servlet-class>
org.codehaus.xfire.transport.http.XFireConfigurableServlet
</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>
请尝试把 <load-on-startup>0 </load-on-startup>中的0 改成 1
使用HttpClient.executeMethod(method)获取Http Web Server的数据时,请注意
URL中的路径不应该包括".."和"."表示的上一层目录和本层目录。否则会引起服务器的
Connection Reset 。 IE和FireFox已经在发送HttpRequest请求前将路径转换,故我们也需要做此工作