Content of the invention
In view of this, the Proxy Method of a kind of the application client of offer and service end mutual message and device.
Specifically, the application is achieved by the following technical solution:
A kind of client and the Proxy Method of service end mutual message, methods described includes:
After receiving the mutual message that client is interacted with service end, call corresponding interface to institute
State mutual message to be processed;
When processing the current interface of described mutual message to having multiple tasks, in the plurality of task
Determine goal task for described mutual message;
Execute described goal task for described mutual message, to realize described current interface to described interaction
The process of message;
After the total interface calling all is processed to described mutual message, forward described mutual message.
Optionally, described is that described mutual message determines goal task in the plurality of task, including:
According to default mapping relations, it is that described mutual message determines corresponding mesh in the plurality of task
Mark task.
Optionally, separate between the corresponding the plurality of task of described current interface.
Optionally, described mutual message includes:Client is sent to request message and the service of service end
End is sent to the response message of client for described request message.
Optionally, when described mutual message is the request message that client is sent to service end, described turn
Sending out mutual message described includes:Described request message is transmitted to service end;
When described mutual message is that service end is directed to the response message that described request message is sent to client,
The described mutual message of described forwarding includes:Described response message is transmitted to client.
A kind of client and the agent apparatus of service end mutual message, described device includes:
Interface interchange unit, after receiving the mutual message that client is interacted with service end, calls
Corresponding interface is processed to described mutual message;
Task determining unit, when processing the current interface of described mutual message to having multiple tasks,
It is that described mutual message determines goal task in the plurality of task;
Task executing units, execute described goal task for described mutual message, described current to realize
The process to described mutual message for the interface;
Message retransmission unit, after the total interface calling all is processed to described mutual message, forwards
Described mutual message.
Optionally, described task determining unit, with specific reference to default mapping relations, at the plurality of
It is that described mutual message determines corresponding goal task in business.
Optionally, separate between the corresponding the plurality of task of described current interface.
Optionally, described mutual message includes:Client is sent to request message and the service of service end
End is sent to the response message of client for described request message.
Optionally, when described mutual message is the request message that client is sent to service end, described report
Described request message is transmitted to service end by civilian retransmission unit;
When described mutual message is that service end is directed to the response message that described request message is sent to client,
Described response message is transmitted to client by described message retransmission unit.
By above description as can be seen that the application is by multiple functional module tasks of same interface, and
When the current interface processing mutual message is to having multiple tasks, it is described interaction in the plurality of task
Message determines goal task, and executes described goal task for described mutual message, to realize described working as
The process to described mutual message for the front port, such that it is able to reduce the degree of coupling of code, is easy to subsequent development
And maintenance.
Specific embodiment
Here will in detail exemplary embodiment be illustrated, its example is illustrated in the accompanying drawings.Following
When description is related to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous
Key element.Embodiment described in following exemplary embodiment does not represent the institute consistent with the application
There is embodiment.On the contrary, they be only with such as appended claims in described in detail, the application one
The example of a little consistent apparatus and method of aspect.
It is the purpose only merely for description specific embodiment in term used in this application, and be not intended to be limiting
The application." a kind of " of singulative used in the application and appended claims, " institute
State " and " being somebody's turn to do " be also intended to including most forms, unless context clearly shows that other implications.Also should
Work as understanding, term "and/or" used herein refers to and comprises one or more associated to list item
Any or all possible combination of purpose.
It will be appreciated that though may be described various using term first, second, third, etc. in the application
Information, but these information should not necessarily be limited by these terms.These terms only be used for by same type of information that
This distinguishes.For example, in the case of without departing from the application scope, the first information can also be referred to as
Two information, similarly, the second information can also be referred to as the first information.Depending on linguistic context, as in this institute
Use word " if " can be construed to " and ... when " or " when ... when " or " response
In determination ".
Realize the high problem of the code degree of coupling that several functions are led to, the application for by same interface
A kind of Proxy Method is provided, refer to Fig. 1, Fig. 1 is the one kind shown in the application one exemplary embodiment
The schematic flow sheet of the Proxy Method of client and service end mutual message, described Proxy Method can include
Following steps:
Step 101, after receiving the mutual message that client is interacted with service end, calls correspondence
Interface described mutual message is processed.
In the present embodiment, after receiving described mutual message, can be according to the class of described mutual message
Type calls one or more interface that described mutual message is processed successively.As an example it is assumed that pin
To mutual message 1, the interface calling is needed to be interface 1, interface 2 and interface 3, then receiving
After stating mutual message 1, first calling interface 1 is processed to described mutual message 1, then can call
Interface 2 is processed to described mutual message 1, and last calling interface 3 is carried out to described mutual message 1
Process, and after interface 3 is disposed to described mutual message 1, be considered as completing to described interaction
The process of message 1.
In the present embodiment, described mutual message can include:Client is sent to the request report of service end
Literary composition and service end are sent to the response message of client for described request message.
Step 102, when processing the current interface of described mutual message to having multiple tasks, described
It is that described mutual message determines goal task in multiple tasks.
In the present embodiment, when needing to realize multiple function by some interface, can be by each work(
Can module be split so that each functional module task, by executing some task, Ke Yishi
Existing corresponding function.Therefore, separate between the multiple tasks of some interface, such that it is able to
Solve the code degree of coupling high, the problems such as being unfavorable for subsequent development and safeguard.
Based on abovementioned steps 101, when calling a certain interface that mutual message is processed, can first sentence
Whether the disconnected current interface being processed is to should have multiple tasks, if current interface is only to should have one to appoint
Business, then can execute this task for described mutual message;If current interface is to should have multiple tasks,
Then can be according to the mapping relations of the mutual message pre-setting and goal task, in the plurality of task
Determine corresponding goal task for described mutual message.Wherein, described mapping relations can be by developer
It is configured according to demand and safeguard.
For example, refer to table 1 it is assumed that interface 1 is to there being three tasks, respectively task A,
Task B and task C, task A is used for realizing function A, and task B is used for realizing function B, task
C is used for realizing function C, then in this step, can according to the mapping relations pre-setting task A,
Goal task is determined for mutual message in task B and task C.
Table 1
Step 103, executes described goal task for described mutual message, to realize described current interface
Process to described mutual message.
Based on abovementioned steps 102, when calling a certain interface that mutual message is processed, for described
After mutual message determines goal task, execute described goal task, that is, execute this current interface pair
The processing procedure of described mutual message.
Taking the citing of abovementioned steps 102 as a example it is assumed that according to the mapping relations pre-setting task A,
The goal task determining for mutual message in task B and task C is task B and task C, then exist
In this step, execute task B and task C for described mutual message, to realize interface 1 to described
The process of mutual message.
Step 104, after the total interface calling all is processed to described mutual message, forwards described
Mutual message.
By above description as can be seen that the application is by multiple functional module tasks of same interface, and
When the current interface processing mutual message is to having multiple tasks, it is described interaction in the plurality of task
Message determines goal task, and executes described goal task for described mutual message, to realize described working as
The process to described mutual message for the front port, such that it is able to reduce the degree of coupling of code, is easy to subsequent development
And maintenance.
Realize process with reference to what specific embodiment to describe the application.
Fig. 2 is another kind of client shown in the application one exemplary embodiment and service end mutual message
The schematic flow sheet of Proxy Method.
Refer to Fig. 2 it is assumed that the request message sending for client needs to call first interface, for
The response message that service end sends needs to call second interface, then described Proxy Method can include following walking
Suddenly:
Step 201, receives the request message that client is sent to service end.
Step 202, calls first interface that described request message is processed.
Step 203, when first interface is to having multiple tasks, is described asking in the plurality of task
Message is asked to determine goal task.
Step 204, in described request message execution step 203 determine described goal task, with
Realize the process to described request message for the described first interface.
Step 205, described request message is transmitted to service end.
Step 206, receives the response message that service end is sent to client for described request message.
Step 207, calls second interface that described response message is processed.
Step 208, when second interface is to having multiple tasks, is described sound in the plurality of task
Message is answered to determine goal task.
Step 209, in described response message execution step 208 determine described goal task, with
Realize the process to described response message for the described second interface.
Step 210, described response message is transmitted to client.
In the embodiment shown in Figure 2, can be using the embodiment of the method shown in aforementioned Fig. 1 to client
Mutual message and service end between is processed, and will not be described here.
Corresponding with the embodiment of the Proxy Method of service end mutual message with aforementioned client, the application is also
Provide the embodiment of client and the agent apparatus of service end mutual message.
The embodiment of the agent apparatus of the application client and service end mutual message can be applied in terminal.
Device embodiment can be realized by software it is also possible to realize by by way of hardware or software and hardware combining.
As a example implemented in software, as the device on a logical meaning, it is the processor by its place terminal
Computer program instructions corresponding in nonvolatile memory are read and in internal memory, runs formation.From hard
For part aspect, as shown in figure 3, the agent apparatus institute for the application client and service end mutual message
In a kind of hardware structure diagram of terminal, except the processor shown in Fig. 3, internal memory, network interface and
Outside nonvolatile memory, in embodiment device be located terminal generally according to this terminal actual functional capability,
Other hardware can also be included, this is repeated no more.
Refer to Fig. 4, Fig. 4 is a kind of client shown in the application one exemplary embodiment and service end
The agent apparatus of the structured flowchart of the agent apparatus of mutual message, described client and service end mutual message
300 can include:Interface interchange unit 301, task determining unit 302, task executing units 303 with
And message retransmission unit 304.
Wherein, described interface interchange unit 301, is receiving the friendship that client is interacted with service end
Mutually after message, call corresponding interface that described mutual message is processed;
Described task determining unit 302, is processing the current interface of described mutual message to should have multiple
During business, it is that described mutual message determines goal task in the plurality of task;
Described task executing units 303, execute described goal task for described mutual message, to realize
The process to described mutual message for the described current interface;
Described message retransmission unit 304, is all processed to described mutual message in the total interface calling
Afterwards, forward described mutual message.
Optionally, described task determining unit 302, with specific reference to default mapping relations, described many
It is that described mutual message determines corresponding goal task in individual task.
Optionally, separate between the corresponding the plurality of task of described current interface.
Optionally, described mutual message includes:Client is sent to request message and the service of service end
End is sent to the response message of client for described request message.
Optionally, when described mutual message is the request message that client is sent to service end, described report
Described request message is transmitted to service end by civilian retransmission unit 304;
When described mutual message is that service end is directed to the response message that described request message is sent to client,
Described response message is transmitted to client by described message retransmission unit 304.
In said apparatus, the process of realizing of the function of unit and effect specifically refers to correspondence in said method
Step realize process, will not be described here.
For device embodiment, because it corresponds essentially to embodiment of the method, so related part ginseng
See that the part of embodiment of the method illustrates.Device embodiment described above is only schematically,
The wherein said unit illustrating as separating component can be or may not be physically separate, make
For the part that unit shows can be or may not be physical location, you can with positioned at a place,
Or can also be distributed on multiple NEs.Can select according to the actual needs part therein or
The whole module of person is realizing the purpose of application scheme.Those of ordinary skill in the art are not paying creativeness
In the case of work, you can to understand and to implement.
The foregoing is only the preferred embodiment of the application, not in order to limit the application, all this
Within the spirit of application and principle, any modification, equivalent substitution and improvement done etc., should be included in
Within the scope of the application protection.