WebService学习(二)

调用webservice查询信息

/**
	 * 回调,报名号,学号,状态
	 * @param RegNumber
	 * @return
	 */
	public static  String webServiceBackScore(String regNumber,String stuNumber,String status) {
		// 创建动态客户端
		  JaxWsDynamicClientFactory factory = JaxWsDynamicClientFactory.newInstance();
		  Client client = factory.createClient("http://219.144.130.166/UionWebService/services/SXJYWebDataService?wsdl");
		  HTTPConduit conduit = (HTTPConduit) client.getConduit();
		  HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
		  httpClientPolicy.setConnectionTimeout(2000); // 连接超时
		  httpClientPolicy.setAllowChunking(false); // 取消块编码
		  httpClientPolicy.setReceiveTimeout(120000); // 响应超时
		  conduit.setClient(httpClientPolicy);	 
		   Object[] objects = new Object[0];
		   // invoke("方法名",参数1,参数2,参数3....);

		    String param = "<?xml version='1.0' encoding='UTF-8'?><body><xgxjx_xsbkxx>"
		    		+ "<xh>"+stuNumber+"</xh>"
		    		+ "<skbmid>"+regNumber+"</skbmid>"
		    		+ "<jfbz>"+status+"</jfbz>"
		    		+ "</xgxjx_xsbkxx></body>";
		   try {
			objects = client.invoke("exchangeData","U04034201","11160001","U2", param);
			
			
		} catch (Exception e) {
			
			e.printStackTrace();
		}

		   System.out.println("返回数据:" + objects[0]);

		   return  objects[0].toString();
		  
		 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值