调用webservice
import javax.servlet.http.HttpServletRequest; import javax.xml.namespace.QName; import javax.xml.rpc.ParameterMode; import javax.xml.rpc.encoding.XMLType; import org.apache.axis.client.Call; import org.apache.axis.client.Service; import org.apache.commons.lang3.StringUtils; public AjaxResult findFrRegisterResult(HttpServletRequest request,String frid)throws Exception{ String url = "http://192.168.1.1:61001/baseifsys/thirdparty/webservice/send?_servicecode=20171214162523111&_token=5edd55bcdc87c57e9e066b19dfc57949"; Service service = new Service(); Call call = (Call) service.createCall(); call.setTargetEndpointAddress(url); // WSDL里面描述的接口名称(要调用的方法) call.setEncodingStyle("UTF-8"); call.setOperationName(new QName("http://10.4.16.7:61001/", "getQyCertification")); //call.setOperationName("validationTicket"); // 接口方法的参数名, 参数类型,参数模式 IN(输入), OUT(输出) or INOUT(输入输出) call.addParameter("jsonParams", XMLType.XSD_STRING, ParameterMode.IN); String jsonParams = "{\"customCode\":\"jxsxxzxsmrzxt\",\"customLisence\":\"6047FE12E15B1A01E053AF0A020A34B0\",\"qymc\":\""+qy_name+"\",\"tyshxydm\":\""+qy_number+"\",\"fddbr\":\""+fr_name+"\",\"zjhm\":\""+fr_idcard+"\"}"; // 设置被调用方法的返回值类型 call.setReturnType(XMLType.XSD_STRING); //设置方法中参数的值 Object[] paramValues = new Object[] {jsonParams}; // 给方法传递参数,并且调用方法 String resultInfo = (String) call.invoke(paramValues); JSONObject json = JSONObject.fromObject(resultInfo); String falg = json.get("flag").toString(); }