java 调用webservice采用axis方式时候无法找到参数注意事项

         String url = "http://192.168.0.90:8088/wsServerExample";
		
		String namespace = "http://webserver.server.com/"; 
		try {
			org.apache.axis.client.Service service = new org.apache.axis.client.Service();

			Call call = (Call) service.createCall();
			// 设置调用服务地址
			call.setTargetEndpointAddress(new java.net.URL(url));
			// 此处一定要配置wsdl的namespace参数
			call.setOperationName(new QName(namespace, "queryObjectOut"));

			// 此处需要配置传入参数类型与参数名称,如果未设置jax-ws则无法接受参数,会认为传入的参数为null 
              //这里的参数名字必须为arg0,否则接受不到参数      call.addParameter("arg0",org.apache.axis.encoding.XMLType.XSD_STRING,javax.xml.rpc.ParameterMode.IN); call.addParameter("arg1", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter("arg2", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); call.addParameter("arg3", org.apache.axis.encoding.XMLType.XSD_STRING, javax.xml.rpc.ParameterMode.IN); // 如果设置类传入参数类型,此处也需要设置返回参数类型 call.setReturnType(org.apache.axis.encoding.XMLType.XSD_STRING); call.setUseSOAPAction(true); call.setSOAPActionURI(url); String result = (String) call .invoke(new Object[] { TransNo, Inxml,"11","21321" }); System.out.println(result); } catch (Exception e) { e.printStackTrace(); }

  

转载于:https://www.cnblogs.com/it888/p/5073839.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值