An example of file upload and download realized by Java in EDI through FTP tool
Recently took over an EDI project and gained a lot. In fact, I came into contact with EDI in the first company. At the beginning, we mainly used EDI to realize order data transmission. Customers issued purchase orders to us, and put the purchase orders in the agreed message form into the specified file server through VPN and FTP tools. Then our EDI system will regularly go to the file server to obtain messages, and finally parse and generate our sales orders. After all these years, I still remember that edi850 and edi855 were used most at the beginning.
1、 First, introduce the concept of EDI
Electronic data interchange.
EDI actually changes the original paper order / delivery notice and other business documents from traditional methods such as fax / express to online electronic data for interaction, so as to improve business efficiency. At the same time, through the implementation and configuration of some EDI software, the corresponding document data can often be directly generated from the enterprise's business system and automatically transmitted to the customer / supplier to achieve the effect of application to application, Avoid human errors (such as data errors) in paper documents. Therefore, large companies with perfect it systems prefer EDI, because EDI is transparent to business personnel, and business personnel can operate their daily business system.
EDI relies on several parts:
1. EDI transmission path: generally, EDI is directly connected through as2 protocol and FTP / s, or transferred through a third-party van (value-added network) service provider (this is the same as the mode we use e-mail). Because business information is involved, the transmission security requirements will be relatively high;
2. EDI standard, that is, the organization form of business data. At present, the most commonly used American Standard ANSI X12 and EDIFACT of the United Nations and the European Union, of course, there are many other standards. As long as EDI both sides follow the same standard, EDI interaction can be well realized;
3. Generally, the best implementation of EDI software (environment) at both ends is that EDI software automatically sends and receives EDI messages (data files) and automatically integrates them into the enterprise business system.
Among the transmission channels, we use FTP for file transmission. Here I mainly introduce how Java uploads and downloads files through FTP tools. Here, our FTP server is Linux operating system.
2、 Java rack package reference
3、 File path the folder path that the client needs to upload is "E: \ EDI \ edi850". By default, all files in this folder are uploaded
4、 Java code FTP class
Ftputil class
After the upload is successful, the FTP file server files are as follows
After downloading successfully, the client files are as follows
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.