Agricultural Bank of matchmaking to the installer through a bank-enterprise platform, and then find a window server systems installed as a front end.
Appendix: bank-enterprise through configuration (local server configuration will be available to the bank, the default TCP protocol, HTTP protocol, although there are options but does not support, the default port occupies 15,999 front-end, you can make changes to the next mode ERP)
The main problem then is to pay docking FEP IP address of the sending 15,999 ports required format of the message on the line, the port will automatically determine the packets according to the transaction code what transaction currently belongs.
The message is not posted, when docking with the technical staff at banks communicate, ask them some considerations message.
// message splicing can choose dom4j Element root = DocumentHelper.createElement("ap"); //根节点 root.addElement ( "CCTransCode") addText ( "CFRT02");. // Trading Symbol root.addElement ( "ProductID") addText ( "ICC");. // product logo root.addElement ( "ChannelType") addText ( "ERP");. // Channel logo return root.asXML();
/** * Data Request: encryption identifier (1 encrypted, no encryption 0) + xml data request length (7 default, not fill the spaces) + xml request public static String genRequestData(String s) throws Exception { return "0" + String.format("%1$-6s", s.getBytes("gbk").length) + s; } // packet is sent there in front of a 2-6 mark as a bit encrypted packet header, this and the next bank to confirm whether encryption, to be sent to the FEP to gbk encoding, from the Internet to find the material means that front-end is gbk encoding, utf8 encryption should be given
/** * TCP packets * @param url * @param port * @param data * @return * @throws Exception */ public static String socketSendAndReceive(String url, int port, String data) throws Exception { System.out.println ( "request data:" + data); Socket socket = new Socket(url, port); OutputStream bw = socket.getOutputStream(); bw.write(data.getBytes("gbk")); bw.flush(); InputStream ips = socket.getInputStream(); StringBuffer sb = new StringBuffer(); int len = 0; byte[] buf = new byte[1024]; while ((len = ips.read(buf)) != -1) { sb.append(new String(buf, 0, len, "gbk")); } bw.close(); ips.close(); socket.close(); return sb.toString(); }
/** * No brain resolves to the XML MAP * * @Param msg * @author jieYW * @date 2018/5/29 * @return com.mind.pay.abc.ap.ApXmlBuilder */ public static Map<String,Object> parseXml(String msg)throws Exception { Map<String,Object> resultMap=new HashMap<>(); msg=msg.substring(msg.indexOf("<")); InputStream inputStream = new ByteArrayInputStream(msg.getBytes("UTF-8")); SAXReader reader = new SAXReader(); Document document = reader.read(inputStream); Element document.getRootElement root = (); List<Element> elementList = root.elements(); // traverse all the child nodes resultMap = getAllElements (member list, resultMap); // release resources inputStream.close(); inputStream = null; return resultMap; } private static Map<String, Object> getAllElements(List<Element> childElements,Map<String,Object> mapEle) { for (Element ele : childElements) { mapEle.put (ele.getName () ele.getText ()); if(ele.elements().size()>0){ mapEle = getAllElements (ele.elements (), mapEle); } } mapEle return; }