CN105959263B - Aged caring institutions data interactive method and system based on JSON - Google Patents

Aged caring institutions data interactive method and system based on JSON Download PDF

Info

Publication number
CN105959263B
CN105959263B CN201610258202.5A CN201610258202A CN105959263B CN 105959263 B CN105959263 B CN 105959263B CN 201610258202 A CN201610258202 A CN 201610258202A CN 105959263 B CN105959263 B CN 105959263B
Authority
CN
China
Prior art keywords
data
endowment
handheld terminal
compression
json
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610258202.5A
Other languages
Chinese (zh)
Other versions
CN105959263A (en
Inventor
叶小谋
王蒙
唐新余
王轶
陈�光
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Zhongke Northwest Star Mdt Infotech Ltd
Original Assignee
Jiangsu Zhongke Northwest Star Mdt Infotech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Zhongke Northwest Star Mdt Infotech Ltd filed Critical Jiangsu Zhongke Northwest Star Mdt Infotech Ltd
Priority to CN201610258202.5A priority Critical patent/CN105959263B/en
Publication of CN105959263A publication Critical patent/CN105959263A/en
Application granted granted Critical
Publication of CN105959263B publication Critical patent/CN105959263B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/565Conversion or adaptation of application format or content

Abstract

The present invention relates to a kind of method and system, especially a kind of Aged caring institutions data interactive method and system based on JSON belongs to the technical field of mobile data interaction.According to technical solution provided by the invention, the Aged caring institutions data interactive method based on JSON can be carried out the endowment server of endowment data interaction including handheld terminal and with the handheld terminal;Data interaction between the handheld terminal and endowment server uses JSON data format.The present invention can simplify data interactive mode, and improve data transfer efficiency guarantees data communications security.

Description

Aged caring institutions data interactive method and system based on JSON
Technical field
The present invention relates to a kind of method and system, especially a kind of Aged caring institutions data interactive method based on JSON and it is System belongs to the technical field of mobile data interaction.
Background technique
With the development of wireless access wide band technology and mobile terminal technology, the highly desirable mobile terminal of people can be at any time Slave internet everywhere obtains information and service.With the rise of mobile internet, various handheld terminals are applied and are become The main entrance of service is obtained, and server end then assumes responsibility for the data storage and computing function of various services.How to guarantee Safe and efficient data interaction between handheld terminal and server end, the problem of becoming developer's overriding concern.
There are two types of traditional handheld terminals and servers' data exchange method: a kind of method is plain text and simple name Title/value pair can add field according to demand, but random larger, and versatility and flexibility be not high;Another kind is based on XML The method of (extensible markup language), XML are a kind of markup languages, and when use can create new mark on demand Note.The element of tape label is the building block of XML document, and such element can have several attributes, and may include zero or more A daughter element, these daughter elements can be text, be also possible to the element of tape label.But XML is as data interaction format Data packet can will lead to the increase of data volume comprising a large amount of duplicate labels.In addition, XML resolution speed is slower, inefficient. So seeming particularly critical using a kind of fast and efficiently data interactive method.
Summary of the invention
The purpose of the present invention is overcoming the deficiencies in the prior art, a kind of Aged caring institutions data based on JSON are provided Exchange method and system, can simplify data interactive mode, and improve data transfer efficiency guarantees data communications security.
According to technical solution provided by the invention, the Aged caring institutions data interactive method based on JSON, including it is hand-held Terminal and the endowment server that can be carried out endowment data interaction with the handheld terminal;The handheld terminal and endowment server Between data interaction use JSON data format.
When carrying out endowment data interaction using JSON data format, the data pack protocol lattice of endowment data to be exchanged are determined Formula, and to the endowment data progress packet encapsulation for determining data pack protocol format, to obtain the encapsulation of data of JSONObject Packet, is successively compressed and is encrypted again to the encapsulated data packet, to obtain compression encrypted packet, to pass through compression encryption number Required data interaction is carried out between handheld terminal and endowment server according to packet.
The data pack protocol format of determination endowment data to be exchanged include type codes, business datum, delete data with And more new data.
A kind of Aged caring institutions data interaction system based on JSON, including handheld terminal and can be into the handheld terminal The endowment server of row endowment data interaction;Data interaction between the handheld terminal and endowment server uses JSON data lattice Formula.
When carrying out endowment data interaction using JSON data format, the data pack protocol lattice of endowment data to be exchanged are determined Formula, and to the endowment data progress packet encapsulation for determining data pack protocol format, to obtain the encapsulation of data of JSONObject Packet, is successively compressed and is encrypted again to the encapsulated data packet, to obtain compression encrypted packet, to pass through compression encryption number Required data interaction is carried out between handheld terminal and endowment server according to packet.
The data pack protocol format of determination endowment data to be exchanged include type codes, business datum, delete data with And more new data.
Advantages of the present invention: the data interaction between the handheld terminal and endowment server uses JSON data format, energy Simplify data interactive mode, improve data transfer efficiency guarantees data communications security.
Detailed description of the invention
Fig. 1 is flow chart of the invention.
Fig. 2 is compression schematic diagram of the invention.
Fig. 3 is the schematic diagram that the present invention decompresses.
Fig. 4 is the schematic diagram of encryption and decryption of the present invention.
Specific embodiment
Below with reference to specific drawings and examples, the invention will be further described.
As shown in Figure 1: in order to simplify data interactive mode, improve data transfer efficiency, the present invention is based on the machines of JSON Structure endowment data interaction system, can be carried out the endowment service of endowment data interaction including handheld terminal and with the handheld terminal Device;Data interaction between the handheld terminal and endowment server uses JSON data format.
Specifically, JavaScript Object Notation (hereinafter referred to as JSON) is a kind of data exchange of lightweight Format, it is using the text formatting for being totally independent of language.JSON uses two kinds of structures: 1) set of " name/value " pair, " name Title/value " can indicate that the attribute of object, object are actually the set of attribute, so this structure can be used to indicate object, A JSON object is indicated using " { } " in typical JSON format.2), the ordered list being worth, can indicate the collection of object It closes, so JSON can indicate the set of a complex object.In typical JOSN format, JSON is indicated using " [] " Array.Based on the related class libraries for being used to handle JSON data for having had comparative maturity in JAVA platform, such as org.json packet It very easily can generate and parse JSON.
When carrying out endowment data interaction using JSON data format, the data pack protocol lattice of endowment data to be exchanged are determined Formula, and to the endowment data progress packet encapsulation for determining data pack protocol format, to obtain the encapsulation of data of JSONObject Packet, is successively compressed and is encrypted again to the encapsulated data packet, to obtain compression encrypted packet, to pass through compression encryption number Required data interaction is carried out between handheld terminal and endowment server according to packet.In the embodiment of the present invention, handheld terminal can be The terminal devices such as existing common smart phone, Intelligent flat, data interaction refer to data between handheld terminal and endowment server JSON data format is all made of in data interaction between mutually transmission, i.e. handheld terminal and endowment server.Handheld terminal to When server transport data of supporting parents, handheld terminal needs for compression encrypted packet to be transmitted in endowment server;And clothes of supporting parents When business device transmits data to handheld terminal, endowment server needs compression encrypted packet being transmitted to handheld terminal.And it supports parents Server or handheld terminal receive compression encrypted packet after, need to compression encrypted packet carry out it is corresponding decryption and Resolving is below described in detail specific implementation process.
When determining the data pack protocol format of endowment data, the data pack protocol is a JSONObject object, Comprising OperationCode (type codes), OperationData (business datum), DeleteData (delete data) and Four fields of UpdateData (more new data), the field be according to handheld terminal with endowment server data synchronize want Ask, in conjunction with geriatric nursing home business demand feature and determine.Specific format is as shown in following table one.
Table one: data pack protocol format
OperationCode type codes are a value, show various operations and the state in data interaction, are divided into upload shape State code and download state code two major classes.Wherein, it uploads status code and sends request to server end for handheld terminal, show to hold Terminal carries out business operation type, such as login authentication, data update;Download state code is for server end of supporting parents to hand-held end Returning response data are held, show various states of the server when carrying out business operation of supporting parents, such as password mistake, Network Abnormal Deng.The type codes are determined by the business demand of Aged caring institutions management system, and with the extension of business, dynamic is adjusted. Below the data exchange process of this system will be introduced by taking system login process as an example.The type of service code used in login process As shown in Table 2.
Table two: type of service code
OperationData business datum is a JSONObject object, and different type codes correspond to different categories Property.It is Login that type codes are uploaded when such as logging in, and data included in business datum are user name, password and mechanism coding three A attribute, this can uniquely determine the membership of this user and geriatric nursing home.
DeleteData deletes data and UpdateData more new data is a JSONArray object, for holding Data are synchronous between terminal and endowment server.In the embodiment of the present invention, using the data synchronization mechanism based on timestamp, When handheld terminal to endowment server issue data update request when, corresponding type codes be Refresh, business datum be comprising The timestamp t of handheld terminal at this time;Endowment server by parsing after obtains this time stamp t, then according to this time stab t with The timestamp t of the endowment each traffic table of server compares, if in the presence of the traffic table also bigger than this time stamp t, then it will be corresponding Business datum is encapsulated among UpdateData field or DeleteData field according to protocol package format.Handheld terminal parsing Protocol package, if above-mentioned two field has corresponding content, handheld terminal carries out corresponding data deletion or data insertion behaviour Make the consistency to keep data.
Die-filling data envelope is that data assembly is carried out according to above-mentioned data pack protocol format, and data pack protocol is exactly one JSONObject, each field again nested according to demand JSONObject, JSONArray etc..Org.json based on java Packet provides a series of simple Method and kit fors for handling JSON data.Wherein org.json.JSONbject class provides A variety of constructors construct JSONbject, name-value pair is added using put method, get method obtains value corresponding to field or Object etc..Such as when handheld terminal logs in, uploading type codes at this time is Login, and operation data is user name, password and endowment Mechanism numbers these three data.Due to the data both not deleted at this time or the data not updated, so above-mentioned two Field is sky, and above-mentioned specific implementation process is known to those skilled in the art, and and will not be described here in detail.
Data compression main purpose is to reduce handheld terminal flow and save server end broadband, and inverse process is decompression Contracting.In geriatric nursing home management system actual application, one side handheld terminal is needed in first initialized data to feeding Old server requests a large amount of basic datas;Another aspect handheld terminal, which needs frequently to upload old man to endowment server, nurses feelings The business operations information such as condition.It is transmitted after being compressed data based on the consideration of such situation, reduces volume of transmitted data, save service Device broadband.
There are Deflater class and Inflater class in java.util.zip packet to provide and be based in JAVA platform The compression of DEFLATE algorithm and the correlation technique of decompression, they call ZLIB to compress library and support general compression by JNI technology Demand.Compression provides support by Deflater class, mainly includes two steps.Byte is converted by the character string of compression first Array completes the conversion of character string to byte arrays by getBytes () method, after changing in embodiments of the present invention Setting Compression Strategies and compression speed execute compression in compressor.Compression Strategies depend on the feature of compressed content, optionally There is FILTERED, is best suited for that the Compression Strategies for the data being arbitrarily distributed to a certain degree are mainly made of and had small value; HUFFMAN_ONLY is only applicable to the Compression Strategies of Huffman coding;And general default Compression Strategies DEFAULT_ STRATEGY uses this rank in embodiments of the present invention.Compression level has 0 to 90 ranks optional, and 0 indicates not compress, 9 represent optimal compression effect, specific as shown in Figure 2.
The safety of data encryption principal security data communication, inverse process are decryption.Encryption and decryption object is by encapsulation Protocol packet data.In the present invention is implemented, byte stream is encrypted using symmetric encipherment algorithm, symmetric cryptography refers to encryption Identical key is used with decryption.Encryption and decryption frame J CF based on java provides a series of tools for encrypting and decrypting, Core classes are Cipher.It calls getInstance (" DES ") to generate Cipher object, this encryption equipment is specified to calculate using des encryption Method also can specify the Encryption Algorithm such as AES/RSA of other modes;Then init () method is called to carry out Cipher object Initialization, while encryption key and encryption mode (encryption or decryption) are set;DoFinal () is finally called to carry out actual add Close or decryption, this depends on the encryption mode being arranged when initialization.If initialization pattern is encryption, doFinal is encrypted; If the mode of initialization is decryption, it is decrypted, as shown in Figure 4.
In the embodiment of the present invention, in data exchange, after receiving compression decrypted data packet, needs to be decrypted, solve Compression and resolving, wherein decrypting process is the inverse process of above-mentioned ciphering process, and decrypting process is according to above-mentioned ciphering process It is determined, detailed process is known to those skilled in the art, and details are not described herein again.Decompression is the inverse process of compression, is used Inflater class serves as decompression machine.The character string that will be decompressed first is converted into byte arrays, is then enter into decompression machine In, it exports as original byte arrays, then original character string is reduced to by toString () method.It should be noted that Be that in decompression, Compression Strategies and compression level must be consistent with the value being arranged when compression, while character turns byte and has to refer to Fixed identical coding mode, as shown in Figure 3.
Data resolution module is the inverse operation to data package module, completes the parsing to protocol package.It parses protocol package Data must construct JSONObject object first, then obtain its specific value or right by each field name in protocol package As carrying out the business operation of next step accordingly.Such as when obtaining above-mentioned protocol package, JSONObject is used first (String) JSONObject object is constructed, calling get (" OperationCode ") acquisition type codes are Login, are learnt to step on Record authentication business operation;Then getJSONObject (" OperationData ") is called to obtain data needed for login authentication, root Corresponding data is obtained according to user name password and geriatric nursing home coding.
If login authentication is out of joint, such as password or username bad, then above-mentioned OperationCode is corresponding Value is LOGIN_ERROR, shows that log-on message is wrong.Other fields are sky, then according to JSON data encapsulation process, by this Content returns to handheld terminal as logon error protocol package.Handheld terminal is parsed according to above-mentioned JSON data, is obtained and is logged in shape State code is LOGIN_ERROR, then prompts handheld terminal user name or password mistake.
A data exchange process below by handheld terminal and endowment server end is come to the course of work of the invention It is illustrated.Firstly, handheld terminal before the request is sent, needs the requirement according to JSON package module the business number of transmission JSONObject is encapsulated as according to according to data pack protocol.Secondly packaged data are compressed by compression module, then Compressed data are encrypted by encryption, finally the data by encryption output are sent.
It after endowment server receives request, first has to that it is decrypted, and using the data after decryption as solution Then the input of pressure obtains the field of agreement package definition by JSON parsing module, and accordingly to determine whether needing to carry out industry Business processing, the rear response that endowment server is sent to handheld terminal if desired then compressed and encrypted, otherwise current communication Process terminates.

Claims (1)

1. a kind of Aged caring institutions data interactive method based on JSON, including handheld terminal and can be carried out with the handheld terminal The endowment server of endowment data interaction;It is characterized in that: the data interaction between the handheld terminal and endowment server uses JSON data format;
When carrying out endowment data interaction using JSON data format, the data pack protocol format of endowment data to be exchanged is determined, And to the endowment data progress packet encapsulation for determining data pack protocol format, to obtain the encapsulated data packet of JSONObject, The encapsulated data packet is successively compressed and encrypted again, to obtain compression encrypted packet, to pass through compression encryption data Packet carries out required data interaction between handheld terminal and endowment server;
The data pack protocol format of the determination endowment data to be exchanged, protocol format include type codes, business datum, delete number Accordingly and more new data;
In data exchange, after receiving compression decrypted data packet, needs to be decrypted, decompress and resolving, wherein Decrypting process is the inverse process of above-mentioned ciphering process, and decrypting process is determined according to above-mentioned ciphering process;Decompression is compression Inverse process, serve as decompression machine with Inflater class;The character string that will be decompressed is converted into byte arrays, is then enter into It in decompression machine, exports as original byte arrays, then original character string is reduced to by toString () method;? Compression Strategies and compression level must be consistent with the value being arranged when compression when decompression, at the same character turn byte have to specify it is identical Coding mode;
Data resolution module is the inverse operation to data package module, completes the parsing to protocol package;It parses protocol packet data JSONObject object must be constructed first, its specific value or object are then obtained by each field name in protocol package, according to This business operation to carry out next step;Corresponding protocol packet data is obtained according to user name password and geriatric nursing home coding;
The handheld terminal before the request is sent, need requirement according to data package module the business datum of transmission according to Data pack protocol is encapsulated as JSONObject;Secondly packaged data are compressed by compression module, then by adding Close to encrypt to compressed data, finally the data by encryption output are sent;
It after endowment server receives request, first has to that it is decrypted, and using the data after decryption as decompression Then input obtains the field of agreement package definition by data resolution module, and accordingly to determine whether needing to carry out at business It manages, the rear response that endowment server is sent to handheld terminal if desired then compressed and encrypted, otherwise current communication process Terminate.
CN201610258202.5A 2016-04-22 2016-04-22 Aged caring institutions data interactive method and system based on JSON Active CN105959263B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610258202.5A CN105959263B (en) 2016-04-22 2016-04-22 Aged caring institutions data interactive method and system based on JSON

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610258202.5A CN105959263B (en) 2016-04-22 2016-04-22 Aged caring institutions data interactive method and system based on JSON

Publications (2)

Publication Number Publication Date
CN105959263A CN105959263A (en) 2016-09-21
CN105959263B true CN105959263B (en) 2019-07-16

Family

ID=56915384

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610258202.5A Active CN105959263B (en) 2016-04-22 2016-04-22 Aged caring institutions data interactive method and system based on JSON

Country Status (1)

Country Link
CN (1) CN105959263B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109240739A (en) * 2018-09-27 2019-01-18 郑州云海信息技术有限公司 A kind of method, apparatus and controlled terminal of rapid configuration BIOS option
CN112822301B (en) * 2021-04-19 2021-07-20 成都同飞科技有限责任公司 Smart card reading and writing method and system based on HTTP (hyper text transport protocol)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103259787A (en) * 2013-04-18 2013-08-21 银江股份有限公司 Safety interactive method of cloud and terminal based on JSON protocol packet in medical field
CN103700254A (en) * 2013-12-31 2014-04-02 同济大学 Position service-based road condition sharing system
CN104298690A (en) * 2013-07-19 2015-01-21 国际商业机器公司 Method and device for building index structure for relational database table and method and device for conducting inquiring
US9009352B1 (en) * 2012-03-28 2015-04-14 Emc Corporation Transformation of common information model messages
CN105187536A (en) * 2015-09-15 2015-12-23 贵阳朗玛信息技术股份有限公司 Data uploading method and data forwarding server
CN105378721A (en) * 2013-03-15 2016-03-02 比乌拉工厂有限公司 Knowledge capture and discovery system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9009352B1 (en) * 2012-03-28 2015-04-14 Emc Corporation Transformation of common information model messages
CN105378721A (en) * 2013-03-15 2016-03-02 比乌拉工厂有限公司 Knowledge capture and discovery system
CN103259787A (en) * 2013-04-18 2013-08-21 银江股份有限公司 Safety interactive method of cloud and terminal based on JSON protocol packet in medical field
CN104298690A (en) * 2013-07-19 2015-01-21 国际商业机器公司 Method and device for building index structure for relational database table and method and device for conducting inquiring
CN103700254A (en) * 2013-12-31 2014-04-02 同济大学 Position service-based road condition sharing system
CN105187536A (en) * 2015-09-15 2015-12-23 贵阳朗玛信息技术股份有限公司 Data uploading method and data forwarding server

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
权重民,彭昕昀.利用JSON实现Android高效、安全访问远程数据库的一种方式.《韶关学院学报•自然科学》.2011,第32卷(第12期),

Also Published As

Publication number Publication date
CN105959263A (en) 2016-09-21

Similar Documents

Publication Publication Date Title
US10313410B2 (en) Systems and methods using binary dynamic rest messages
CN107529132B (en) Method and device for transmitting data between Bluetooth device and application program
EP1593204B1 (en) System and method for compression structured definition language
US20090198761A1 (en) Message encoding/decoding using templated parameters
CN111224864A (en) Message transmission method and device, computer equipment and storage medium
CN104054068A (en) Improved bandwidth optimization for remote desktop protocol
JP2004274355A (en) Method for creating and processing soap message, method and apparatus for processing information, and program
US20180253559A1 (en) Secured lossless data compression using encrypted headers
CN103957241A (en) Communication method and device based on message data
CN112511514A (en) HTTP encrypted transmission method and device, computer equipment and storage medium
CN102739644B (en) A kind of sending/receiving method of finance data and device
CN106603579B (en) The tele-control system and method and its wireless terminal of a kind of wireless terminal
CN112383881B (en) Information reporting method, device, equipment and storage medium
CN101964722A (en) Be used for method for communicating and system
Itani et al. J2ME application-layer end-to-end security for m-commerce
CN112491832B (en) File transmission method and device
CN105959263B (en) Aged caring institutions data interactive method and system based on JSON
US11743364B2 (en) Method for interconversion between protocols
CN104123244A (en) USB redirection system and method
CN109460646A (en) Method for identifying ID, device, system, electronic equipment and readable medium
JP2023520776A (en) Method and system for compression encryption
Chu et al. OMA DM v1. x compliant Lightweight Device Management for Constrained M2M devices
KR101066610B1 (en) A transmission system for compression and division of xml and json data
EP2640018A1 (en) Protocol modeling & engineering system
CN111064560B (en) Data encryption transmission method and device, terminal and data encryption transmission system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 214135 Block C, International Innovation Park of China Sensor Network, 200 Linghu Avenue, Wuxi New District, Jiangsu Province

Applicant after: Jiangsu Zhongke northwest star Mdt InfoTech Ltd

Address before: 214135 Block C, International Innovation Park of China Sensor Network, 200 Linghu Avenue, Wuxi New District, Jiangsu Province

Applicant before: WUXI ZHONGKE NORTH-WEST STAR TECHNOLOGY CO., LTD.

GR01 Patent grant
GR01 Patent grant
PE01 Entry into force of the registration of the contract for pledge of patent right
PE01 Entry into force of the registration of the contract for pledge of patent right

Denomination of invention: JSON-based mechanism aged care data interaction method and system

Effective date of registration: 20191105

Granted publication date: 20190716

Pledgee: Bank of Jiangsu Limited by Share Ltd Wuxi New District sub branch

Pledgor: Jiangsu Zhongke northwest star Mdt InfoTech Ltd

Registration number: Y2019990000465