CN103179133B - Based on the client of entity class and the method for server communication - Google Patents

Based on the client of entity class and the method for server communication Download PDF

Info

Publication number
CN103179133B
CN103179133B CN201310127953.XA CN201310127953A CN103179133B CN 103179133 B CN103179133 B CN 103179133B CN 201310127953 A CN201310127953 A CN 201310127953A CN 103179133 B CN103179133 B CN 103179133B
Authority
CN
China
Prior art keywords
client
communication
server
entity class
data
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
CN201310127953.XA
Other languages
Chinese (zh)
Other versions
CN103179133A (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.)
Sino Parsons Technology Beijing Co ltd
Original Assignee
Beijing University of Technology
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 Beijing University of Technology filed Critical Beijing University of Technology
Priority to CN201310127953.XA priority Critical patent/CN103179133B/en
Publication of CN103179133A publication Critical patent/CN103179133A/en
Application granted granted Critical
Publication of CN103179133B publication Critical patent/CN103179133B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Computer And Data Communications (AREA)
  • Telephonic Communication Services (AREA)

Abstract

Provided by the invention based on the client of entity class and the method for server communication, comprise communication interface and communication functions that definition client and server communicate for entity class and the client and server of transfer of data; Server opens service, and client data is imparted to corresponding entity class and sequence turns to Json report, is sent to server by communication interface; Server end carries out unserializing to Json report and obtains entity class data, obtains result by Business Processing; Result is imparted in entity class by server end, and entity class data sequence is turned to Json message byte sequence, turns back to client by communication interface; Client is carried out unserializing to Json message byte sequence and is obtained entity class data, then carries out Business Processing to these entity class data.The method of the client based on entity class provided by the invention and server communication effectively alleviates communication pressure and project complexity, makes the communication of client and server more succinct efficient.

Description

Based on the client of entity class and the method for server communication
Technical field
The present invention relates to Internet communication technology field, particularly relate to a kind of based on the client of entity class and the method for server communication.
Background technology
At the internet development initial stage, webpage is fairly simple, and only comprise word or a small amount of picture, on traditional mobile terminal, browser generally adopts http protocol to visit server.But along with the development of the Internet, the content and form of webpage is more and more abundanter, and web page contents not only contains word, also have a large amount of picture, multimedia messages and external etc.According to the statistics display of google in 2012, every width webpage probably has 88 resources, needs the website that access 14 is different, and mean size 640KB.
Current based in the scientific research of the Internet, no matter adopt C/S framework or B/S framework, develop a kind of software or product, general use C speech like sound or java class language, if each module uses same class language, then smooth without communication, but along with development and the renewal of technology, in increasing situation, need to use multiclass programming language joint development program, client and java class language compilation server end is write as used C speech like sound, but data type is different, the reasons such as data format disunity, the data communication of each intermodule can be caused to go wrong.
In order to solve the problem, current solution is socket approach, during each communication, first a passage is set up to connect the particular port of client-requested to server end at client and server end, then the field of client is read out one by one, deposit in the carrier such as stream, xml, properties, then by carrier, field is sent to server end, server end is resolved, regenerate object, again field is saved in the carrier such as stream, xml, properties, passes back to client.
The data direction of transfer of this solution is the carrier-> client such as the carrier-> such as client-> stream, xml, properties server end-> stream, xml, properties; Cause a lot of problem simultaneously, mainly contain two aspects:
1, data will at client and carrier, ceaselessly change between server end and carrier, process more complicated and be easy to produce mistake;
2, be that different clients by different language compilation, may be in the communication process of server end, just need the intermediate carrier of different-format, increase project complexity, be difficult to management.
Especially in the mega project of complexity, the communication intermediate carrier of complicated data type, a large amount of data and multiple format is not only easy produces the problems such as data distortion in data transaction, also easily because communication pressure is excessive cause communication collapse.
Therefore, for the problem existing for prior art, the technical problem solved in the urgent need to those skilled in the art is to provide effective measures, to solve prior art Problems existing.
Summary of the invention
Technical problem to be solved by this invention is to provide a kind of based on the client of entity class and the method for server communication, for alleviating communication pressure and project complexity, makes the communication of client and server more succinct efficient.
In order to solve the problem, the invention discloses a kind of based on the client of entity class and the method for server communication, comprising:
Definition client and server are used for the entity class of transfer of data;
The communication interface of definition client and server communication and communication functions;
In communication process, server opens service, and client data is imparted to corresponding entity class and sequence turns to Json message byte sequence, is sent to server end by communication interface;
Server end carries out unserializing to Json message byte sequence and obtains entity class data, obtains result by Business Processing;
Result is imparted in entity class by server end, and entity class data sequence is turned to Json message byte sequence, turns back to client by communication interface;
Client is carried out unserializing to Json message byte sequence and is obtained entity class data, then carries out Business Processing to these entity class data.
Further, the communication interface of described definition client and server communication and communication functions comprise the communication interface of definition server end and communication functions, the communication interface of definition client and communication functions and realize the flow process of client-access server end.
Further, described method illustrates the communication interface title that entity class is corresponding and service corresponding under one's name thereof when client definition communication interface simultaneously.
Further, described method also comprises: the data access class that definition communication class, Data Access Base Class, the data manipulation of encapsulation base and each entity class are corresponding.
Further, when client sends data to the method for server end, data access class calling data access base class, Data Access Base Class is calling communication class again, in communication class, entity class data sequence is turned to Json message byte sequence, by the service that communication interface access services device end is corresponding.
Further, the client defined is identical for the entity class of transfer of data with server.
Further, when described definition client and server are used for the entity class of transfer of data, use SybasePowerDesigner tool design entity class and write corresponding control routine, generating the client entity class code corresponding with server respectively.
Further, during communication, client is by IP address and port access server, then is connected to concrete service by communication interface.
Further, the described end of text character only occurs once in same annex.
To sum up, this programme is applied in clear data transmission reception, can utilize its succinct coding and decoding efficiency efficiently, greatly reduce length and the memory space of ciphertext, strengthen the transmission rate of channel, thus reduce the transmission delay of data; Meanwhile, threshold schemes and trusted third party is utilized to add the fail safe of transmission data.
Accompanying drawing explanation
Fig. 1 is of the present invention a kind of schematic flow sheet based on the client of entity class and the method for server communication.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with accompanying drawing and example, the present invention is described in further detail.But example is not as a limitation of the invention.
Shown in Figure 1, a kind of schematic flow sheet based on the client of entity class and the method for server communication of the present invention, specifically comprises following key step:
Step SA01, definition client and server are used for the entity class of transfer of data;
Step SA02, the communication interface of definition client and server communication and communication functions;
Step SA03, in communication process, server opens service, and client data is imparted to corresponding entity class and sequence turns to Json message byte sequence, is sent to server end by communication interface;
Step SA04, server end carries out unserializing to Json message byte sequence and obtains entity class data, obtains result by Business Processing;
Step SA05, result is imparted in entity class by server end, and entity class data sequence is turned to Json message byte sequence, turns back to client by communication interface;
Step SA06, client is carried out unserializing to Json message byte sequence and is obtained entity class data, then carries out Business Processing to these entity class data.
Concrete, the present invention proposes a kind ofly to carry out for the C client of writing and the server end that Java writes the method that communicates based on entity class, different C class development languages directly can be communicated with server by entity class, reduce communications burden, improve communication efficiency, strengthen the robustness of system.
In practical application, client and server communication comprise four parts: server end and client define identical entity class (101), server end and client and define communication interface (102), and this is the basis of whole model; Client process data (103), comprise process be sent to server end data and process from received server-side to data; Server-side processes data (104), comprise the data that data that process receives from client and process are sent to client.
101: server end and client define identical entity class, this is the basis of whole communication, and these entity class both can as the carrier of transfer of data in communication, data object when also can carry out Business Processing as client and server.Identical in order to ensure the entity class of client and server, SybasePowerDesigner tool design entity class can be used and write corresponding control routine, to generate entity class code corresponding to client and server respectively.
102: server end and client define communication interface, this is the passage of whole communication.This communication interface is made up of two parts, and be the communication interface that handler defines all services corresponding to entity class respectively, service defines the idiographic flow of a communication service in handler.During communication, client by IP address and port access server end, then is connected to concrete service by communication interface.
Above two steps are that the basis of whole model prepares, and following client arranges IP address and the port numbers of corresponding server end, and server end opens service, enters communication process.
103: client process data, comprise process be sent to server end data and process from received server-side to data.
Client process is sent to the data of server end
First the entity class data that step 1 client traffic flow process produces enter data access class with the communication interface called;
Step 2 enters Data Access Base Class by data access class, Data Access Base Class includes parameter, has the communication interface of return value to call, there is parameter, call without the communication interface of return value, printenv, have the communication interface of return value to call, entity class data enter Data Access Base Class by calling one of them interface;
Step 3 enters communication class by Data Access Base Class, communication class comprises the function such as process, log recording, unidirectional transmission data, unidirectional reception data, bi-directional data when the initialization of communication functions, communication, network settings, data transmission fault, and entity class data sequence turns to the function that the function of byte sequence and byte sequence are deserialized as entity class data.
Step 4 entity class data are after communication class is turned to Json message byte sequence by sequence, by the one of the unidirectional transmission of definition in step 3, unidirectional reception, bi-directional three kinds of communication modes, Json message byte sequence is sent to server end by calling communication interface.If this step selects this communication mode of unidirectional reception, then only transmit communication interface, the Json message byte sequence not after translation sequence; If this step selects other two kinds of communication modes, then to transmit the Json message byte sequence after communication interface and serializing.
104: server-side processes data, comprise the data that data that process receives from client and process are sent to client.
The data that server-side processes receives from client
The Json message byte sequence that step 5 client sends over calls the handler of correspondent entity class by communication interface, then enters corresponding communication service service;
Step 6service calls business logic processing flow processing data, Json message byte sequence is deserialized as entity class data, deal with data process comprises and first judges whether forward data is List queue, if, do special Json unserializing process, the string form transmitted is deserialized as entity class data; If not, the Json message byte sequence of the string form transmitted directly is deserialized as entity class data;
Step 7 entity class data enter the concrete handling process of service, and the additions and deletions according to calling the definition of DAO layer change database manipulations such as looking into, bear results;
The result obtained is corresponded in corresponding entity class by service logic function by step 8, and entity class data sequence is turned to the Json message byte sequence of string form.
Server-side processes is sent to the data of client
The Json message byte sequence produced in step 8 is sent in the communication class of client by step 9 service logic function.If select this communication mode of unidirectional transmission in the step 4 of 103, then Json message byte sequence no longer returns, and only returns one and judges successful true(or false) value; If what select is other two kinds of communication modes, then to return Json message byte sequence.
103: client process from received server-side to data
The Json message byte sequence that first server end is returned by communication class by step 10 client is deserialized as entity class data, and these entity class data are delivered in Data Access Base Class go, unserializing process is that client is by the unidirectional transmission in communication class, unidirectional reception, after one in bi-directional three kinds of communication modes receives Json message byte sequence, unserializing process is carried out to it, first judge whether forward data is List queue, if, do special Json unserializing process, the Json message byte sequence of the string form transmitted is deserialized as entity class data, carry out corresponding operation again data are shown, if not, the Json message byte sequence of the string form transmitted directly is deserialized as entity class data.
Step 11 is passed data in data access class by Data Access Base Class.
The whole communication process of step 12 terminates, and next calls client traffic handling process deal with data.
Be described in detail based on the client of entity class and the method for server communication provided by the present invention above, apply specific case herein to set forth principle of the present invention and execution mode, the explanation of above embodiment just understands method of the present invention and core concept thereof for helping; Meanwhile, for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (7)

1., based on the client of entity class and a method for server communication, it is characterized in that, comprising:
Definition client and server are used for the entity class of transfer of data, and the client defined is identical for the entity class of transfer of data with server;
The communication interface of definition client and server communication and communication functions;
In communication process, server opens service, and client data is imparted to corresponding entity class and sequence turns to Json message byte sequence, is sent to server end by communication interface;
Server end carries out unserializing to Json message byte sequence and obtains entity class data, obtains result by Business Processing;
Result is imparted in entity class by server end, and entity class data sequence is turned to Json message byte sequence, turns back to client by communication interface;
Client is carried out unserializing to Json message byte sequence and is obtained entity class data, then carries out Business Processing to these entity class data.
2. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that:
The communication interface of described definition client and server communication and communication functions comprise the definition communication interface of server end and communication functions, the communication interface of definition client and communication functions and realize the flow process of client-access server end.
3. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that, described method illustrates the communication interface title that entity class is corresponding and service corresponding under one's name thereof when client definition communication interface simultaneously.
4. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that, described method also comprises: define the data access class that communication class, Data Access Base Class, the data manipulation of encapsulation base and each entity class are corresponding.
5. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that, when client sends data to the method for server end, data access class calling data access base class, Data Access Base Class is calling communication class again, in communication class, entity class data sequence is turned to Json message byte sequence, by the service that communication interface access services device end is corresponding.
6. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that, when described definition client and server are used for the entity class of transfer of data, use SybasePowerDesigner tool design entity class and write corresponding control routine, generating the client entity class code corresponding with server respectively.
7. as claimed in claim 1 based on the client of entity class and the method for server communication, it is characterized in that, during communication, client is by IP address and port access server, then is connected to concrete service by communication interface.
CN201310127953.XA 2013-04-12 2013-04-12 Based on the client of entity class and the method for server communication Active CN103179133B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310127953.XA CN103179133B (en) 2013-04-12 2013-04-12 Based on the client of entity class and the method for server communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310127953.XA CN103179133B (en) 2013-04-12 2013-04-12 Based on the client of entity class and the method for server communication

Publications (2)

Publication Number Publication Date
CN103179133A CN103179133A (en) 2013-06-26
CN103179133B true CN103179133B (en) 2016-03-30

Family

ID=48638756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310127953.XA Active CN103179133B (en) 2013-04-12 2013-04-12 Based on the client of entity class and the method for server communication

Country Status (1)

Country Link
CN (1) CN103179133B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103428270A (en) * 2013-07-09 2013-12-04 国云科技股份有限公司 Network communication method applicable to distributed-type environment
CN103605518B (en) * 2013-11-19 2017-12-19 北京国双科技有限公司 Object unserializing method and apparatus
CN103593194B (en) * 2013-11-21 2017-12-22 北京国双科技有限公司 Object serialization method and apparatus
CN105681333A (en) * 2016-02-24 2016-06-15 携程计算机技术(上海)有限公司 Binary-system-based network data transmission method and system
CN107656819A (en) * 2016-07-25 2018-02-02 武汉票据交易中心有限公司 The processing method and related system of a kind of operation flow
CN106227545B (en) * 2016-07-28 2019-09-10 武汉源启科技股份有限公司 The design method and device of development platform
CN106354568A (en) * 2016-08-23 2017-01-25 京信通信技术(广州)有限公司 Method and device for communication between different processes
CN107562842A (en) * 2017-08-25 2018-01-09 北京市天元网络技术股份有限公司 The guard method of resource data and equipment
CN109753270B (en) * 2017-11-01 2022-05-20 中国石油化工股份有限公司 Expandable drilling service data exchange system and method
CN110971581B (en) * 2018-09-30 2022-05-27 北京国双科技有限公司 Encrypted data processing method and device
CN110298032B (en) * 2019-05-29 2022-06-14 西南电子技术研究所(中国电子科技集团公司第十研究所) Text classification corpus labeling training system
CN110262901B (en) * 2019-06-27 2023-06-20 深圳前海微众银行股份有限公司 Data processing method and data processing system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101714078A (en) * 2008-10-06 2010-05-26 广东金宇恒科技有限公司 Code generation method and device
CN102624895A (en) * 2012-03-09 2012-08-01 亿赞普(北京)科技有限公司 Method and system for processing network service request

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8332467B2 (en) * 2009-07-29 2012-12-11 International Business Machines Corporation Lightweight RRD extension framework
US9094435B2 (en) * 2009-12-23 2015-07-28 Citrix Systems, Inc. Systems and methods for prevention of JSON attacks

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101714078A (en) * 2008-10-06 2010-05-26 广东金宇恒科技有限公司 Code generation method and device
CN102624895A (en) * 2012-03-09 2012-08-01 亿赞普(北京)科技有限公司 Method and system for processing network service request

Also Published As

Publication number Publication date
CN103179133A (en) 2013-06-26

Similar Documents

Publication Publication Date Title
CN103179133B (en) Based on the client of entity class and the method for server communication
CN102902537B (en) Based on the embedded type WEB MVC Development Framework of FastCGI and html template
CN104754536A (en) Method and system for realizing communication between different languages
CN106686021B (en) Service calling method and gateway
US20150067013A1 (en) Methods for servicing web service requests using parallel agile web services and devices thereof
CN106909361A (en) Web development approaches and device based on masterplate engine
CN104135536A (en) Data interaction method of Web management system based on Json data protocols
CN105893508A (en) Method, device and system for determining access sequence of native page and H5 page
Dai et al. Automatic analysis of complex interactions in microservice systems
CN103138871B (en) The server data processing system of application program and method in mobile communcations system
CN107229516B (en) Data processing method and device
CN107483412A (en) A kind of HTML5 web worker moving methods and system
CN102761543A (en) Method and device for realizing SIP (session initiation protocol) universal encoding and decoding
CN102436391A (en) Android WebKit control method and system
CN108153745B (en) Application data calling method and application development system
US7779139B2 (en) Normalization of binary data
CN104598250A (en) System management structure and management implementation method for same
CN103646015A (en) Method and system for sending, receiving and transmitting XML message
CN103561113A (en) Web Service interface generating method and device
CN105260179A (en) Method for achieving flex and servlet interaction
CN103139227B (en) A kind of application data transmission system and method being applied to mobile terminal
CN102025755A (en) Method and device for aggregating network resources
CN105320499A (en) Adaptive method and related device of application program
Gong et al. Wwof: an energy efficient offloading framework for mobile webpage
CN113065077A (en) Horizontal extension middle station service processing 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
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20201117

Address after: 233000 Room 102 north, No.11, No.2 building, liukm Huayuan commercial building, Changqing Township, Yuhui District, Bengbu City, Anhui Province

Patentee after: Anhui Licha Information Technology Co.,Ltd.

Address before: 102600, room 2, building 2212, center 3, 2 Xinghua street, Daxing District, Beijing

Patentee before: BEIJING YONGBO TECHNOLOGY Co.,Ltd.

Effective date of registration: 20201117

Address after: 102600, room 2, building 2212, center 3, 2 Xinghua street, Daxing District, Beijing

Patentee after: BEIJING YONGBO TECHNOLOGY Co.,Ltd.

Address before: 100124 Chaoyang District, Beijing Ping Park, No. 100

Patentee before: Beijing University of Technology

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20211103

Address after: 101300 North Cultural Ying Village, Gaoliying Town, Shunyi District, Beijing (No. 1, Linkong Second Road)

Patentee after: SINO-PARSONS TECHNOLOGY (BEIJING) Co.,Ltd.

Address before: 233000 Room 102 north, No.11, No.2 building, liukm Huayuan commercial building, Changqing Township, Yuhui District, Bengbu City, Anhui Province

Patentee before: Anhui Licha Information Technology Co.,Ltd.