package com.esky.shop.util;
import javax.xml.rpc.ParameterMode;
import java.net.MalformedURLException;
import java.rmi.RemoteException;
import java.util.Iterator;
import org.apache.axis.encoding.XMLType;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
public class CheckDongZhi {
private static Call selectCall = null;
private static final CheckDongZhi oaconnection = new CheckDongZhi();
//state webService链接
//private static final String state =" CommonForChange.OA_URL;
private static final String state = "http://10.9.21.138:8088/Fol/services/folserviceForOtherSystem.seam?wsdl";
private static final String endpoint = state;
private CheckDongZhi() {
try {
Service service = new Service();
selectCall = (Call) service.createCall();
selectCall.setOperationName(new QName(state, "call"));//getBudgetNoService 调用webService方法
selectCall.setTargetEndpointAddress(new java.net.URL(endpoint));
} catch (Exception e) {
e.printStackTrace();
}
}
public static CheckDongZhi getInstance() {
return oaconnection;
}
/***
*
*方法描述:发送数据
* @param users 需要发送的Json串(其中包括动值单号)
* @param ret 返回的数据字符
* @param path
* @param serviceName
* @return
*/
public String selectPending(String code){
String ret = "";
try {
System.out.println("发送参数:"+code);
Service service = new Service();
selectCall = (Call) service.createCall();
selectCall.setOperationName(new QName(state, "call"));
selectCall.setTargetEndpointAddress(new java.net.URL(endpoint));
ret = (String) selectCall.invoke(new Object[]{code});
} catch (RemoteException e1) {
e1.printStackTrace();
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ret;
}
//返回的内容是json{ applyid: 动支申请号 14位,: 动支报销余额,businessactivityname : 活动项,currencytype :币种类型,budgetponum :动支号 5开头 10位,budgetponum :动支号 5开头 10位,applycompanycode :申请公司code,applycompanyname :申请公司名称,status :是否完成,只有6代表完成 }
public static void main(String[] args) {
// System.out.println(CheckDongZhi.getInstance().selectPending("{'sys':'请求系统标识','Key':'平台提供密码标识','type':'3','request':{'no':'12040050225963',dept:'8370'}}"));
System.out.println(CheckDongZhi.getInstance().selectPending("{'sys':'请求系统标识','Key':'平台提供密码标识','type':'3','request':{'no':'11120050000810',dept:'1700'}}"));
}
}