加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

利用axis请求webservice接口

发布时间:2020-12-16 21:53:39 所属栏目:安全 来源:网络整理
导读:jar包 aixs.jar import org.apache.axis.AxisProperties; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.axis.encoding.XMLType; String examId = map.get("EXEAM_ID").toString(); String chnlId = login

jar包 aixs.jar

import org.apache.axis.AxisProperties;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;



String examId = map.get("EXEAM_ID").toString();
String chnlId = loginUser.getChnlCode();
String mobileNo = loginUser.getPhone();

//设置代理
AxisProperties.setProperty("http.proxyHost","ccc.com.net");
AxisProperties.setProperty("http.proxyPort","8081");


Service service = new Service();
String service_url = "http://xx.com/webservice/examinfo.asmx?wsdl";
String targetNameSpace = "http://tempuri.org/";
Call call = (Call)service.createCall();


call.setTargetEndpointAddress(new java.net.URL(service_url));
call.setOperationName(new QName(targetNameSpace,"GetExamStatus"));

//设置参数
call.addParameter(new QName(targetNameSpace,"ExamId"),XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN);
call.addParameter(new QName(targetNameSpace,"chnlId"),"mobileNo"),javax.xml.rpc.ParameterMode.IN);

//设置返回类型
call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING);?

call.setUseSOAPAction(true);? call.setSOAPActionURI(targetNameSpace+"GetExamStatus"); //返回信息:0(考生不存在) 1(已考) 2(未考) 3(超期未考) String result = call.invoke(new Object[]{ examId,chnlId,mobileNo}).toString();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读