Java调用WebService之Axis实现
2021-07-14 13:08
阅读:971
标签:end classname 姓名 cat cli version soa -- code
import org.apache.axis.client.Call; import org.apache.axis.client.Service; /** * @ClassName: TestAxis * @Description: TODO(描述这个类的作用) * @author Roy_70 * @date 2017年4月18日 上午9:16:26 * */ public class TestAxis { public static void main(String []args){ String inConditions = ""; String inLicense = "********"; try{ //调用webservice地址 String url = "https://www.****.com/services/NciicServices"; //调用方法名 String method="nciicCheck"; Service service = new Service(); //通过service创建call对象 Call call = (Call) service.createCall(); //设置服务地址 call.setTargetEndpointAddress(new java.net.URL(url)); //设置调用方法 call.setOperationName(method); call.setUseSOAPAction(true); //添加方法的参数,有几个添加几个 //inLicense是参数名,XSD_STRING是参数类型,IN代表传入 call.addParameter("inLicense", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN); call.addParameter("inConditions", org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN); //设置返回类型 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); Object ret= null; try{ //使用invoke调用方法,Object数据放传入的参数值 ret = call.invoke(new Object[] {inLicense,inConditions}); }catch(Exception e){ e.printStackTrace(); } //输出SOAP请求报文 System.out.println("--SOAP Request: " + call.getMessageContext().getRequestMessage().getSOAPPartAsString()); //输出SOAP返回报文 System.out.println("--SOAP Response: " + call.getResponseMessage().getSOAPPartAsString()); //输出返回信息 System.out.println("result==="+ret.toString()); }catch(Exception e){ e.printStackTrace(); } } } * |
公民身份号码 姓名 |
110101****** 李闻 100600 个人贷款 |
3624221952123*** 李一闻 100600 个人贷款 |
1234******** 王龙 100600 银行开户 |
110101****** 100600 个人车贷 |
110101****** 100600 |
230602*** 100600 个人车贷
下面是输出结果信息:
--SOAP Request:--SOAP Response: ***** ***** result=== <?xml version="1.0" encoding="UTF-8"?> <RESPONSE errorcode="-72" code="0" countrows="1"><ROWS><ROW><ErrorCode>-72</ErrorCode><ErrorMsg>IP地址受限</ErrorMsg></ROW></ROWS></RESPONSE> |
-72 IP地址受限
Java调用WebService之Axis实现
标签:end classname 姓名 cat cli version soa -- code
原文地址:https://www.cnblogs.com/lm970585581/p/9538223.html
上一篇:SpringCloud03 Ribbon知识点、 Feign知识点、利用RestTemplate+Ribbon调用远程服务提供的资源、利用feign调用远程服务提供的资源
下一篇:jQuery-事件
文章来自:搜素材网的编程语言模块,转载请注明文章出处。
文章标题:Java调用WebService之Axis实现
文章链接:http://soscw.com/index.php/essay/105127.html
文章标题:Java调用WebService之Axis实现
文章链接:http://soscw.com/index.php/essay/105127.html
评论
亲,登录后才可以留言!