CN104363184B - A kind of JSON message processing methods and system based on tuxedo communication patterns - Google Patents

A kind of JSON message processing methods and system based on tuxedo communication patterns Download PDF

Info

Publication number
CN104363184B
CN104363184B CN201410602089.9A CN201410602089A CN104363184B CN 104363184 B CN104363184 B CN 104363184B CN 201410602089 A CN201410602089 A CN 201410602089A CN 104363184 B CN104363184 B CN 104363184B
Authority
CN
China
Prior art keywords
json
messages
message
interface
service
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
CN201410602089.9A
Other languages
Chinese (zh)
Other versions
CN104363184A (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.)
Beijing Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology Co 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 Beijing Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN201410602089.9A priority Critical patent/CN104363184B/en
Publication of CN104363184A publication Critical patent/CN104363184A/en
Application granted granted Critical
Publication of CN104363184B publication Critical patent/CN104363184B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention relates to a kind of JSON message processing methods and system based on tuxedo communication patterns, the described method includes:The interface to communicate between service call end and tuxedo server-sides is defined, and is defined through the service fields and field type of interface;JSON messages comprising service fields are put into a long character string by service call end, and are sent to tuxedo server-sides, and tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;Tuxedo server-sides take out the service fields of needs, and carry out business processing to the service fields of taking-up according to the service fields and field type by interface of definition from JSON messages;Result after business processing is assembled into the JSON messages for meeting interface requirement according to the requirement that service return interface defines;The JOSN messages being assembled into are converted into a long character string, are returned with STRING communication modes.The present invention enables the not treatable JSON message formats message of conventional communication mode to handle, and solves the communication issue of its own system and external system.

Description

A kind of JSON message processing methods and system based on tuxedo communication patterns
Technical field
The present invention relates to JSON Message processing technologies, more particularly to a kind of JSON messages based on tuxedo communication patterns Processing method and system.
Background technology
With the popularity of the telecom industry and the increasing speed of business expansion, aerial charging system with being outside external door The interaction of system is also increased, and communication message form is also more versatile and flexible.Traditional communication service cannot have been supported such as This flexible message communication form of JSON messages, the message if communication message form is JSON are transmitted to tuxedo server-sides When, tuxedo, which services used queue communication mode, can not meet to realize that parsing and tissue are sent, and there are problems with:
1. if JSON messages are longer and when logic is more complicated, the service processing time will extend;
2. when handling JSON messages, due to largely being handled using address pointer, however not excluded that processing is abnormal to cause system Memory overflow.
Therefore, the present invention proposes a kind of JSON message processing methods and system based on tuxedo communication patterns.
The content of the invention
The technical problems to be solved by the invention are to provide a kind of JSON Message processing sides based on tuxedo communication patterns Method and system, for solving confinement problems existing for traditional tuxedo clients or server-side processing JSON messages.
The technical solution that the present invention solves above-mentioned technical problem is as follows:A kind of JSON messages based on tuxedo communication patterns Processing method, including:
Interface definition step, defines the interface to communicate between service call end and tuxedo server-sides, and defines warp Cross the service fields and field type of interface;
JSON messages comprising service fields are put into a long character string by message receiving step, service call end, and Tuxedo server-sides are sent to, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
Message processing step, tuxedo server-sides according to the service fields and field type by interface of definition, from The service fields of needs are taken out in JSON messages, and business processing is carried out to the service fields of taking-up;
Message number of assembling steps, the result after business processing is assembled according to the requirement that service call end return interface defines Into the JSON messages for meeting interface requirement;
Message forwarding step, is converted to a long character string by the JOSN messages being assembled into, is returned with STRING communication modes Back to service call end.
Based on the above technical solutions, the present invention can also be improved as follows.
Further, in the message receiving step, service call end will include the length of JSON messages using STRING modes Character string is sent to tuxedo server-sides.
Further, in the Message processing step, tuxedo server-sides according to definition by the service fields of interface and Field type, the service fields that needs are taken out from JSON messages specifically include:Long character string comprising JSON messages is stored Into the JSON list structures specified, tuxedo server-sides are from first memory BOB(beginning of block), defined in JSON list structures Order takes out JSON messages successively, further according to the service fields and field type by interface of definition, is taken from JSON messages Go out the service fields of needs.
Further, the long character string comprising JSON messages is stored to specified using encapsulation function cJSON_Parse () In JSON list structures.
Further, JSON messages are taken out using function cJSON_GetObjectItem ().
Further, in the Message processing step, the service fields of taking-up include array, numeral, object and character string.
Further, in the message number of assembling steps, the service fields after business processing is assembled into and meet interface requirement JSON messages when, without considering the sequence of service fields.
Further, in the message forwarding step, the JOSN messages being assembled into are changed using function cJSON_Print () For a long character string.
Technical scheme further includes a kind of JSON message handling systems based on tuxedo communication patterns, including:
Interface definition module, for defining the interface to communicate between service call end and tuxedo server-sides, and it is fixed Justice passes through the service fields and field type of interface;
Message receiving module, for the JSON messages comprising service fields to be put into a long character by service call end In string, and tuxedo server-sides are sent to, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
Message processing module (MPM), for the service fields and field class by interface by tuxedo server-sides according to definition Type, takes out the service fields of needs from JSON messages, and carries out business processing to the service fields of taking-up;
Message assembles module, for the requirement for defining the result after business processing according to service call end return interface It is assembled into the JSON messages for meeting interface requirement;
Message sending module, for the JOSN being assembled into messages to be converted to a long character string, with STRING communication parties Formula returns to service call end.
Further, in the message processing module (MPM), tuxedo server-sides according to definition by the service fields of interface and Field type, the service fields that needs are taken out from JSON messages specifically include:Long character string comprising JSON messages is stored Into the JSON list structures specified, tuxedo server-sides are from first memory BOB(beginning of block), defined in JSON list structures Order takes out JSON messages successively, further according to the service fields and field type by interface of definition, is taken from JSON messages Go out the service fields of needs.
The beneficial effects of the invention are as follows:By the present invention in that the JSON messages Intelligent treatment side with tuxedo communication patterns Formula, enables the not treatable JSON message formats message of conventional communication mode to handle, and solves aerial charging system and outside The communication and business handling processing of system outdoors.Existing many services are supplied to many interfaces to use, and the parameter of return is relatively more, Desired data can be only taken out using this scheme to be handled, and saved the execution time, will especially for transaction real-time Ask high, the big system of data volume, improves execution efficiency, reduces distributed host resource, saves hardware costs.
Brief description of the drawings
Fig. 1 is the flow diagram of the JSON message processing methods of the present invention based on tuxedo communication patterns;
Fig. 2 is the structure diagram of the JSON message handling systems of the present invention based on tuxedo communication patterns.
Embodiment
The principle and features of the present invention will be described below with reference to the accompanying drawings, and the given examples are served only to explain the present invention, and It is non-to be used to limit the scope of the present invention.
As shown in Figure 1, this gives a kind of JSON message processing methods based on tuxedo communication patterns, bag Include:
Interface definition step, defines the interface to communicate between service call end and tuxedo server-sides, and defines warp Cross the service fields and field type of interface;
JSON messages comprising service fields are put into a long character string by message receiving step, service call end, and Tuxedo server-sides are sent to, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
Message processing step, tuxedo server-sides according to the service fields and field type by interface of definition, from The service fields of needs are taken out in JSON messages, and business processing is carried out to the service fields of taking-up;
Message number of assembling steps, the result after business processing is assembled according to the requirement that service call end return interface defines Into the JSON messages for meeting interface requirement;
Message forwarding step, is converted to a long character string by the JOSN messages being assembled into, is returned with STRING communication modes Back to service call end.
Wherein, in the message receiving step, service call end will include the long word of JSON messages using STRING modes Symbol string is sent to tuxedo server-sides.
In the Message processing step, tuxedo server-sides according to the service fields and field type of defining interface, from The service fields that needs are taken out in JSON messages specifically include:Long character string comprising JSON messages is stored to specified JSON In structured data-chained list, tuxedo server-sides, from first memory BOB(beginning of block), are removed and are connect according to the message character string received All control characters in receiving text, successively circulation are taken out JSON messages, are put into one by one in JSON structured datas-chained list, further according to The service fields and field type that interface defines, take out the service fields of needs from JSON structured datas-chained list.Data structure Include:A structure inlet pointer on chained list, the next structure inlet pointer of chained list, corresponding data type, corresponding data, phase The one-to-one title of JSON strings is answered, also comprising sub- JSON structures.
In addition, this example is stored the long character string comprising JSON messages to finger using encapsulation function cJSON_Parse () In fixed JSON list structures;Corresponding JSON is taken out according to JSON names using function cJSON_GetObjectItem () Message;The json character strings that cJSON structures are converted into tape format using function cJSON_Print () are returned.
It is noted that in the message number of assembling steps, the service fields after business processing are assembled into and meet interface It is required that JSON messages when, without considering the sequence of service fields.
As shown in Fig. 2, the present embodiment gives a kind of JSON message handling systems based on tuxedo communication patterns, bag Include:
Interface definition module, for defining the interface to communicate between service call end and tuxedo server-sides, and it is fixed Justice passes through the service fields and field type of interface;
Message receiving module, for the JSON messages comprising service fields to be put into a long character by service call end In string, and tuxedo server-sides are sent to, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
Message processing module (MPM), for the service fields and field class by interface by tuxedo server-sides according to definition Type, takes out the service fields of needs from JSON messages, and carries out business processing to the service fields of taking-up;
Message assembles module, for the requirement for defining the result after business processing according to service call end return interface It is assembled into the JSON messages for meeting interface requirement;
Message sending module, for the JOSN being assembled into messages to be converted to a long character string, with STRING communication parties Formula returns to service call end.
The system is consistent with the principle of the above-mentioned JSON message processing methods based on tuxedo communication patterns.
With reference to above, the specific implementation process of the technical solution of the present embodiment mainly includes following components.
First, the reception of JSON messages.
External system client or intermediary service, which return, sends JSON messages, and the JSON form messages comprising service fields are put Enter in a long character string, message is sent in a manner of the STRING of tuxedo to server-side.Server-side is received in a manner of STRING Message.
2nd, the processing of JSON messages.
After server-side receives message in a manner of STRING, the long character string of JSON forms is taken out.First with encapsulation function CJSON_Parse () stores the character string of JSON message formats in the JSON list structures specified, and value is according to pointer Circulated successively from first memory block and take out all objects and type, until terminating.The service fields that are defined further according to interface and Field type, the service fields value that being taken out using corresponding encapsulation function is needed carry out business processing for business.Can processing field Type includes:Array, numeral, object (sub- JSON strings), character string.Take and JSON objects are first taken out during occurrence, use function: CJSON_GetObjectItem (), then object numerical value is obtained, such as obtain character string:Object->valuestring
Example is as follows:
J_body=cJSON_GetObjectItem (j_root, " BODY ");// obtain JSON business division information
J_login_no=cJSON_GetObjectItem (j_body, " LOGIN_NO ");// obtain in main information The JSON objects of LOGIN_NO
strncpy(login_no,j_login_no->valuestring,strlen(j_login_no-> valuestring));The parameter value of the specific LOGIN_NO (string types) of // acquirement
3rd, JSON message traffics field assembles:After the completion of business business processing, the data assembling to return is needed at this time The JSON message formats defined into interface.Different assembling functions, field type that can be processed are used according to the difference of field type Including:Array, numeral, object (sub- JSON strings), character string.During assembling, as long as value can add at any time to corresponding data In JSON strings, out-of-order requirement.
Example is as follows:
Outjson=cJSON_CreateObject ();
CJSON*fmt=NULL;// initiation parameter
CJSON_AddItemToObject (outjson, " ROOT ", fmt=cJSON_CreateObject ());// Increase sub- JSON node Rs OOT under root node
cJSON_AddStringToObject(fmt,"ENDUSRLOGINID",endusrloginid);// in child node Increase string ENDUSRLOGINID under ROOT
4th, the transmission of JSON messages.
Using JSON messages as a long character string, returned packet is sent to clothes using the STRING communication modes of tuxedo End is called in business, JSON messages can be converted to character string using function cJSON_Print () function and be passed through tuxedo's STRING communication modes send returned packet to service call end
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all the present invention spirit and Within principle, any modification, equivalent replacement, improvement and so on, should all be included in the protection scope of the present invention.

Claims (8)

  1. A kind of 1. JSON message processing methods based on tuxedo communication patterns, it is characterised in that including:
    Interface definition step, defines the interface to communicate between service call end and tuxedo server-sides, and is defined through and connects The service fields and field type of mouth;
    Message receiving step, the JSON messages comprising service fields are put into a long character string by service call end, and are sent Tuxedo server-sides are given, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
    Message processing step, the long character string comprising JSON messages is stored into specified JSON list structures, tuxedo clothes End be engaged in from first memory BOB(beginning of block), JSON messages are taken out successively by the order defined in JSON list structures, further according to definition The service fields and field type by interface, the service fields of needs are taken out from JSON messages, and to the business of taking-up Field carries out business processing;
    Message number of assembling steps, symbol is assembled into by the result after business processing according to the requirement that service call end return interface defines Close the JSON messages of interface requirement;
    Message forwarding step, is converted to a long character string by the JSON messages being assembled into, is returned to STRING communication modes Service call end.
  2. 2. JSON message processing methods according to claim 1, it is characterised in that in the message receiving step, service Call end that the long character string comprising JSON messages is sent to tuxedo server-sides using STRING modes.
  3. 3. JSON message processing methods according to claim 1, it is characterised in that using encapsulation function cJSON_Parse () stores the long character string comprising JSON messages into specified JSON list structures.
  4. 4. JSON message processing methods according to claim 1, it is characterised in that using function cJSON_ GetObjectItem () takes out JSON messages.
  5. 5. JSON message processing methods according to claim 1, it is characterised in that in the Message processing step, take out Service fields include array, numeral, object and character string.
  6. 6. JSON message processing methods according to claim 1, it is characterised in that, will be through in the message number of assembling steps When service fields after business processing are assembled into the JSON messages for meeting interface requirement, without considering the sequence of service fields.
  7. 7. JSON message processing methods according to claim 1, it is characterised in that in the message forwarding step, use The JSON messages being assembled into are converted to a long character string by function cJSON_Print ().
  8. A kind of 8. JSON message handling systems based on tuxedo communication patterns, it is characterised in that including:
    Interface definition module, for defining the interface to communicate between service call end and tuxedo server-sides, and defines warp Cross the service fields and field type of interface;
    Message receiving module, for the JSON messages comprising service fields to be put into a long character string by service call end In, and tuxedo server-sides are sent to, tuxedo server-sides receive the long character string comprising JSON messages in a manner of STRING;
    Message processing module (MPM), for storing the long character string comprising JSON messages into specified JSON list structures, Tuxedo server-sides take out JSON messages from first memory BOB(beginning of block) successively by the order defined in JSON list structures, then According to the service fields and field type by interface of definition, the service fields of needs are taken out from JSON messages, and to taking The service fields gone out carry out business processing;
    Message assembles module, for the result after business processing to be assembled according to the requirement that service call end return interface defines Into the JSON messages for meeting interface requirement;
    Message sending module, for the JSON being assembled into messages to be converted to a long character string, is returned with STRING communication modes Back to service call end.
CN201410602089.9A 2014-10-31 2014-10-31 A kind of JSON message processing methods and system based on tuxedo communication patterns Active CN104363184B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410602089.9A CN104363184B (en) 2014-10-31 2014-10-31 A kind of JSON message processing methods and system based on tuxedo communication patterns

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410602089.9A CN104363184B (en) 2014-10-31 2014-10-31 A kind of JSON message processing methods and system based on tuxedo communication patterns

Publications (2)

Publication Number Publication Date
CN104363184A CN104363184A (en) 2015-02-18
CN104363184B true CN104363184B (en) 2018-04-17

Family

ID=52530411

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410602089.9A Active CN104363184B (en) 2014-10-31 2014-10-31 A kind of JSON message processing methods and system based on tuxedo communication patterns

Country Status (1)

Country Link
CN (1) CN104363184B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106549917A (en) * 2015-09-21 2017-03-29 中兴通讯股份有限公司 The method and apparatus of distinct interface protocol massages conversion processing
CN111447120B (en) * 2020-03-30 2021-08-20 中国建设银行股份有限公司 Pressure testing method and system based on Tuxedo

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102394874A (en) * 2011-10-26 2012-03-28 深圳天源迪科信息技术股份有限公司 TUXEDO (Transaction for UNIX has been Extended for Distributed Operation) data protocol conversion method
CN101695172B (en) * 2009-10-16 2012-06-27 北京天碁科技有限公司 Method and device for independent description and encoding of message interfaces of communication equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102377631B (en) * 2010-08-06 2015-08-05 北京乾唐视联网络科技有限公司 A kind of data transmission method based on flow control and communication system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101695172B (en) * 2009-10-16 2012-06-27 北京天碁科技有限公司 Method and device for independent description and encoding of message interfaces of communication equipment
CN102394874A (en) * 2011-10-26 2012-03-28 深圳天源迪科信息技术股份有限公司 TUXEDO (Transaction for UNIX has been Extended for Distributed Operation) data protocol conversion method

Also Published As

Publication number Publication date
CN104363184A (en) 2015-02-18

Similar Documents

Publication Publication Date Title
CN102104541B (en) Header processing engine
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
CN102790776B (en) Heartbeat connection normalizing processing method, terminal, server and communication system
CN105684382A (en) Packet control method, switch and controller
CN108322437B (en) Adaptive communication method and device for multiple protocol devices
CN103401783A (en) Method and device for realizing Openflow multistage flow table
CN105471603B (en) Method, device and system for remotely configuring PTP (precision time protocol) service of optical network unit
CN108769017A (en) A kind of data communications method and device
EP4044529A1 (en) Detnet data packet processing method and apparatus
CN104363184B (en) A kind of JSON message processing methods and system based on tuxedo communication patterns
WO2021088813A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN105847041B (en) A kind of exchange method based on network management system command-line data
CN106878178B (en) Flow table issuance method, system and controller
CN105760134B (en) A kind of data processing method and electronic equipment
CN108092914B (en) Network traffic load balancing scheduling method and device
CN102984083A (en) Queue management method and device
CN109587082A (en) A kind of asynchronous repeater system of message based on (SuSE) Linux OS and method
CN105024923B (en) The method and device that message category based on XMPP extension message is realized
CN105027491B (en) The system and method for clearly resetting column split
CN105453659B (en) Data receiving-transmitting method, modem and terminal device
CN206024025U (en) A kind of home gateway
CN105227544B (en) Realize the device and method of different agreement message conversion
CN109379342B (en) UDP network protocol-based upper computer and DSP data transmission method
CN112953953A (en) Communication protocol design method, terminal and computer storage medium
CN111865957A (en) Frame structure and method and system thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant