Embodiment
The various exemplary embodiments of the present invention are described in detail now with reference to accompanying drawing.It should be noted that:Unless had in addition
Body illustrates that the part and the positioned opposite of step, numerical expression and numerical value otherwise illustrated in these embodiments does not limit this
The scope of invention.
The description only actually at least one exemplary embodiment is illustrative below, never as to this hair
Bright and its application or any limitation used.
It may be not discussed in detail for technology, method and apparatus known to person of ordinary skill in the relevant, but suitable
In the case of, the technology, method and apparatus should be considered as a part for specification.
In shown here and discussion all examples, any occurrence should be construed as merely exemplary, without
It is as limitation.Therefore, other examples of exemplary embodiment can have different values.
It should be noted that:Similar label and letter represents similar terms in following accompanying drawing, therefore, once a certain item exists
It is defined, then it need not be further discussed in subsequent accompanying drawing in one accompanying drawing.
Below, each embodiment and example according to the present invention are described with reference to the accompanying drawings.
<Method>
Fig. 1 shows the schematic flow according to an embodiment of the invention for being used to handle the method for response data
Figure.
As shown in figure 1, in step S1100, receiving response data.HTTP request can be used to ask to respond to server
Data.The response data can be the response data from server.For example, the response data is JSON data characters
String.
For example, a service request includes:Unique request ID (service identification) and multiple service parameters are (for example, start
Date, Close Date etc.).Server end carries out business processing according to different service identifications and returns to response data.Returned
Response data be, for example, JSON character string datas.Here is the example of JSON character strings, and it includes:The field name of response is (for example
" IMEI_APP_DOWN_UP_BTN_CLICK_PV "), field type (such as " yyyy-MM-dd HH:Mm "), traffic value (example
Such as " 9667 ").
In step S1200, based on configuration file, using utilizing the class specified in configuration file, dynamic generation business datum
Object.
Here, the configuration file is also included in the first field and the service data object to be generated in response data
The second field corresponding relation.The configuration file is, for example, XML file.Here, the first field is referred in response data
Field.Response data can include one or more first fields.Second field refers to service request side to be mapped to
Field, it can be one or more second fields.
For example, the XML file can include the first field (name) in response data, the field class in response data
Format transformation information between the second field (name), the first field and the second field in type, the object to be generated etc..Fig. 6
It is an example of XML file.
For example, the first field " IMEI_APP_DOWN_UP_BTN_CLICK_PV " is mapped in generated object
Second field " ravImeiAppDownUpBtnClickPv ".Here, interface identifier is also based on (for example, id=
" 106651 "), it is the different configuration informations in different interface option and installment files.
In addition, in order to simplify configuration information, general configuration information can be released and be put into single common configuration
In project.For example, id=" root " project is common configuration project above., can be with when needing to use common configuration project
The common configuration project is specified to be used as father's configuration information.
Unlike the prior art, the content in the service data object is based on configuration file life when being handled
Into.Herein, make use of allows the characteristic of the programming language of dynamic construction object when program is run.For example, configuration file
In specified class be class that this programming language is write, it allows dynamic generation object.For example, the programming language can
To be Java language.In this case, the class is java class.The service data object is Java service data objects.
In step S1300, the traffic value of the first field is obtained from response data.Here, the response data includes first
The traffic value of field and the first field.
For example, the configuration file also includes the format information of the second field.Format information based on second field
Change the traffic value.The requirement of service request side can so be met.
In step S1400, the traffic value of the first field is set corresponding into service data object based on configuration file
Second field.
Service data object after setting is returned into calling service side, so that it is used.
In the above-described embodiments, programming language is make use of dynamically to produce Properties of Objects to handle response data.This
Sample, it is possible to use configuration file meets the request of data demand of different business.This can improve efficiency.
In addition, when interface or data change, this change can be adapted to simply by changing configuration file
Change.This improves the flexibility of system.
<Equipment>
It will be appreciated by those skilled in the art that in electronic technology field, can by software, hardware and software and
The mode of combination of hardware, embodies those skilled in the art in the product by the above method and is easy to be based on method as disclosed above,
A kind of equipment for handling response data is produced, the equipment includes being used to perform according to the embodiment for handling
Each operation in the method for response data.For example, the equipment includes:Device for receiving response data;For based on
Configuration file using the device using the class dynamic generation service data object specified in configuration file, wherein, the configuration
File also includes the corresponding relation of the first field and the second field in the service data object to be generated in response data,
Content in the service data object is based on configuration file generation when being handled;For being obtained from response data
The device of the traffic value of first field;And for the traffic value of the first field being set based on configuration file arrive business datum
The device of corresponding second field in object.
For example, the equipment for handling response data can be the electronic equipment of such as server or terminal device
In part or such as application software in the electronic equipment client device in part.
<Client device>
Fig. 2 shows the schematic block diagram of client device according to an embodiment of the invention.
As shown in Fig. 2 client device 2000 includes the equipment 2010 recited above for being used to handle response data.
The client device is, for example, the application in electronic equipment.
It is more direct and be explicitly described one in addition, for the those of ordinary skill of electronic information technical field
The mode of technical scheme is to describe each operation in the program.Knowing in the case of operation to be performed, this area skill
Art personnel can directly design desired product.For in terms of this, in this embodiment, a kind of visitor is additionally provided
Family end equipment, it is designed to perform the operation in the method described in Fig. 1.
It is well known by those skilled in the art that the hair of the electronic information technology with such as large scale integrated circuit technology
Exhibition and the trend of hardware and software, will clearly divide computer system soft and hardware boundary and seem relatively difficult.Because,
Any operation can realize with software, can also be by that should realize.The execution of any instruction can be completed by hardware, equally
It can also be completed by software.Hardware implementations or software implement scheme are used for a certain machine function, depending on valency
The Non-technical factors such as lattice, speed, reliability, memory capacity, change cycle.For the technician, software realization side
Formula and hardware implementation mode are equivalent.Technical staff can select software or hardware to realize such scheme as needed.Cause
This, does not limit specific software or hardware here.
<Electronic equipment>
Each embodiment according to the present invention can be realized in the electronic device.The electronic equipment is, for example, notebook
Computer, smart mobile phone, tablet personal computer, server etc..
Fig. 3 shows the schematic block diagram of electronic equipment according to an embodiment of the invention.
As shown in figure 3, electronic equipment 3000 can include processor 3010, it is memory 3020, interface arrangement 3030, logical
T unit 3040, display device 3050, input unit 3060, loudspeaker 3070, microphone 3080, etc..
Processor 3010 is such as can be central processor CPU, Micro-processor MCV.Memory 3020 for example including
ROM (read-only storage), RAM (random access memory), nonvolatile memory of hard disk etc..Interface arrangement 3030
Such as including USB interface, earphone interface.
Communicator 3040 can for example carry out wired or wireless communication.
Display device 3050 is, for example, LCDs, touch display screen etc..Input unit 3060 can for example include touching
Touch screen, keyboard etc..User can pass through loudspeaker 3070 and the inputting/outputting voice information of microphone 3080.
Electronic equipment shown in Fig. 3 is only explanatory, and is never intended to the limitation present invention, its application or uses
On the way.
In this embodiment, the memory 3020 is used for store instruction, and the instruction is used to control the processor
3010 are operated to perform the operation in the method for handling response data described in above reference picture 1.Art technology
Personnel it will be appreciated that though figure 3 illustrates multiple devices, still, the present invention can only relate to partial devices therein,
For example, processor 3010 and storage device 3020 etc..Technical staff can instruct according to presently disclosed conceptual design.Refer to
How control processor is operated for order, and this is it is known in the art that therefore being not described in detail herein.
<Example>
Fig. 4 is can to apply the schematic diagram of the example of network system according to an embodiment of the invention.Fig. 5 is according to this
The schematic diagram of the example of one embodiment of invention.
As shown in figure 4, terminal device 4020,4030 and server 4040,4050 are connected with each other by network.Can be
The technical side according to above-described embodiment is realized in any one in terminal device 4020,4030 and server 4040,4050
Case.
In Figure 5, one according to an embodiment of the invention is illustrated by taking terminal device 4020 and server 4040 as an example
Example.
As shown in figure 5, the service request direction server request data in terminal device 4020.Terminal device 4020 can
To include multiple service request sides.Terminal device 4020 sends HTTP request of data to server 4040.
Server 4040 post-processes the request and generates http response data receiving HTTP request of data.It is described
Http response data are, for example, JSON data.
Http response data are sent to terminal device 4020 by server 4040.
Terminal device 4020 can use singleton pattern to handle the data after response data is received.
For example, terminal device 4020 loads XML configuration file.Terminal device 4020 can be based on connecing in configuration file
Mouth mark determines the configuration information to be loaded.Terminal device 4020 uses configuration text based on the configuration information in configuration file
Specified class, dynamic generation service data object, for example, JAVA service data objects in part.Here, service data object
In content be not it is pre-setting or it is advance compiling generation.Content in the service data object is at progress
Generated during reason based on configuration file.
Then, according to the configuration file, the traffic value in response data is set corresponding into service data object
In field.The field that the configuration file is included in response data is corresponding with the field in the service data object to be generated
Relation.
Here, configuration file can be keyword/value to form data.So, can when using configuration information
Rapidly to obtain configuration information from configuration file.
Set service data object can be reprocessed or handled, to store in database, supply system
System is used.
Here, by using configuration file, in calling interface during response data to obtain return, it is not necessary to for every
One interface repeats to write similar parsing code.This can improve efficiency.It is alternatively possible to make application program more succinct, lead to
It is higher with property.
The present invention can be equipment, method and/or computer program product.Computer program product can include calculating
Machine readable storage medium storing program for executing, containing for making processor realize the computer-readable program instructions of various aspects of the invention.
Computer-readable recording medium can keep and store to perform the tangible of the instruction that equipment is used by instruction
Equipment.Computer-readable recording medium, which for example can be ,-- but is not limited to-and-storage device electric, magnetic storage apparatus, light deposits
Store up equipment, electromagnetism storage device, semiconductor memory apparatus or above-mentioned any appropriate combination.Computer-readable storage medium
The more specifically example (non exhaustive list) of matter includes:Portable computer diskette, hard disk, random access memory (RAM),
Read-only storage (ROM), erasable programmable read only memory (EPROM or flash memory), static RAM
(SRAM), Portable compressed disk read-only storage (CD-ROM), digital versatile disc (DVD), memory stick, floppy disk, mechanical coding
Equipment, the punch card for being for example stored thereon with instruction or groove internal projection structure and above-mentioned any appropriate combination.This
In used in computer-readable recording medium be not construed as instantaneous signal in itself, such as radio wave or other freedom
The electromagnetic wave of propagation, the electromagnetic wave (for example, the light pulse for passing through fiber optic cables) propagated by waveguide or other transmission mediums,
Or the electric signal transmitted by electric wire.
Computer-readable program instructions as described herein can download to each meter from computer-readable recording medium
Calculation/processing equipment, or outer computer is downloaded to by network, such as internet, LAN, wide area network and/or wireless network
Or External memory equipment.Network can include copper transmission cable, optical fiber transmit, be wirelessly transferred, router, fire wall, exchange
Machine, gateway computer and/or Edge Server.Adapter or network interface in each calculating/processing equipment are from net
Network receives computer-readable program instructions, and forwards the computer-readable program instructions, for being stored in each calculating/processing
In computer-readable recording medium in equipment.
Can be that assembly instruction, instruction set architecture (ISA) refer to for performing the computer program instructions that operate of the present invention
Make, machine instruction, machine-dependent instructions, microcode, firmware instructions, condition setup data or with one or more programming languages
Source code or object code that any combination of speech is write, programming language of the programming language including object-oriented-such as
Smalltalk, C++ etc., and conventional procedural programming languages-such as " C " language or similar programming language.Computer
Readable program instructions fully can on the user computer be performed, partly performed on the user computer, as one
Independent software kit is performed, part is performed or completely in remote computation on the remote computer on the user computer for part
Performed on machine or server.In the situation of remote computer is related to, remote computer can by the network of any kind-
Including LAN (LAN) or wide area network (WAN)-subscriber computer is connected to, or, it may be connected to outer computer (example
Such as using ISP come by Internet connection).In certain embodiments, by using computer-readable journey
The status information of sequence instruction comes personalized customization electronic circuit, such as PLD, field programmable gate array
(FPGA) or programmable logic array (PLA), the electronic circuit can perform computer-readable program instructions, so as to realize this
The various aspects of invention.
Referring herein to method according to embodiments of the present invention, device (system) and computer program product flow chart and/
Or block diagram describes various aspects of the invention.It should be appreciated that each square frame and flow chart of flow chart and/or block diagram and/
Or in block diagram each square frame combination, can be realized by computer-readable program instructions.
These computer-readable program instructions can be supplied to all-purpose computer, special-purpose computer or other programmable numbers
According to the processor of processing unit, so as to produce a kind of machine so that these instructions are passing through computer or other programmable numbers
According to processing unit computing device when, generate specified in one or more of implementation process figure and/or block diagram square frame
The device of function/action.Can also be the storage of these computer-readable program instructions in a computer-readable storage medium, this
A little instructions cause computer, programmable data processing unit and/or other equipment to work in a specific way, so that, be stored with finger
The computer-readable medium of order then includes a manufacture, and it includes one or more of implementation process figure and/or block diagram
The instruction of the various aspects of function/action specified in square frame.
Computer-readable program instructions can also be loaded into computer, other programmable data processing units or other
In equipment so that perform series of operation steps on computer, other programmable data processing units or miscellaneous equipment, with
Computer implemented process is produced, so that being held on computer, other programmable data processing units or miscellaneous equipment
Function/action specified in one or more of capable instruction implementation process figure and/or block diagram square frame.
Flow chart and block diagram in accompanying drawing show system, method and the computer of multiple embodiments according to the present invention
Architectural framework in the cards, function and the operation of program product.At this point, each square frame in flow chart or block diagram can
To represent a module, program segment or a part for instruction, the module, program segment or a part for instruction comprising one or
Multiple executable instructions for being used to realize defined logic function.In some realizations as replacement, marked in square frame
Function can also be with different from the order marked in accompanying drawing generation.For example, two continuous square frames can essentially substantially simultaneously
Perform capablely, they can also be performed in the opposite order sometimes, this is depending on involved function.It is also noted that frame
The combination of figure and/or each square frame in flow chart and the square frame in block diagram and/or flow chart, can be defined with performing
Function or the special hardware based system of action realize, or can use the combination of specialized hardware and computer instruction
To realize.To those skilled in the art it is well known that, realized by hardware mode, by software mode realize and
Realize it is all of equal value by way of software and hardware is combined.
It is described above various embodiments of the present invention, described above is exemplary, and non-exclusive, and
It is also not necessarily limited to disclosed each embodiment.In the case of without departing from the scope and spirit of illustrated each embodiment, for this
Many modifications and changes will be apparent from for the those of ordinary skill of technical field.The selection of term used herein,
It is intended to best to explain the principle of each embodiment, practical application or to the technological improvement in market, or makes the art
Other those of ordinary skill are understood that each embodiment disclosed herein.The scope of the present invention is defined by the appended claims.