Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of service interface supplying method and system based on URL(uniform resource locator) in http protocol, provide the module interface of the network data flow broadcasting service that meets Real-time Transport Protocol few for solving prior art, function is simple, invoked frequency is low and use in being limited among a small circle, and this module can not be by different processes, different file, different language, the problem of the module accesses of different platform.
For achieving the above object and other relevant objects, one aspect of the present invention provides a kind of service interface supplying method based on URL(uniform resource locator) in http protocol, be applied in the communication network of client and server end composition, comprise: send the HTTP request with URL(uniform resource locator) form to network by designated port, the described HTTP request with URL(uniform resource locator) form refers to the request head of http protocol, the HTTP request of URL(uniform resource locator) form can be expressed request task performed in service processes, and required parameter is provided; Parsing has the HTTP request of URL(uniform resource locator) form, and whether the command format that checks the HTTP request with URL(uniform resource locator) form is legal to judge it, if so, reply the legal response of form, carry out the HTTP request with URL(uniform resource locator) form; If not, reply the illegal response of form; Detect and feed back the executing state of the HTTP request with URL(uniform resource locator) form; The executing state wherein, with the HTTP request of URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP asks in the middle of operation and this HTTP request finishes to move.
Preferably, the step that sends the HTTP request with URL(uniform resource locator) form by designated port to network also comprises the HTTP request with URL(uniform resource locator) form that generates; The HTTP request that generation has URL(uniform resource locator) form is to fill according to starting to send network data flow, end transmission network data flow or requester network data flow state demand the URL(uniform resource locator) part that HTTP asks, wherein, described URL(uniform resource locator) part comprises HTTP method, order line and parameter; Wherein HTTP method is GET method; Order line form is [client ip address]: [client port]/client service process.
Preferably, the HTTP request that parsing has URL(uniform resource locator) form is beginning taking described GET method tail of string as order line, the ending taking question mark in described parameter as order line, parses client ip address, client port and client service process that described HTTP asks.
Preferably, have described in judgement the command format of HTTP request of URL(uniform resource locator) form whether legal according to being whether to exist according to described request parameter, and parameter value be sky.
Preferably, the HTTP request that has URL(uniform resource locator) form by designated port to network transmission comprises: by specifying the first port to send and start to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form to network; And meet RTP network data flow and there is the HTTP request of URL(uniform resource locator) form or send by specifying the 3rd port to send inquiry to network the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form by specifying the second port to send to finish to send to network.
Preferably, by specifying the first port to send and start to send the HTTP request that meets the network data flow of RTP and there is URL(uniform resource locator) form to network; Wherein, start to send the whether needs circulation transmission of encoding and decoding that come source file, destination address that network data flow sends, target port that network data flow sends, network data current load that required parameter that the HTTP that meets the network data flow of RTP and have a URL(uniform resource locator) form ask to provide comprises network data flow and network data flow; Parsing starts to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form; Inspection starts to send the command format that meets the network data flow of RTP and have the HTTP request of URL(uniform resource locator) form; Judgement start to send meet the network data flow of RTP and there is the command format of HTTP request of URL(uniform resource locator) form whether legal, if, reply the legal response of form, execution starts to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form, and obtains the general unique identifier of mark that this HTTP request is carried out; If not, reply the illegal response of form; Detect and feed back and start to send the executing state that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form.
Preferably, by specifying the second port to send and finish to send the HTTP request that meets RTP network data flow and there is URL(uniform resource locator) form to network; Wherein, finishing to send required parameter that the HTTP that meets RTP network data flow and have a URL(uniform resource locator) form ask to provide comprises from meeting the network data flow of RTP and have the general unique identifier obtaining the process that the HTTP of URL(uniform resource locator) form asks by specifying the first port to send to start to send to network; Resolve and finish to send the HTTP request that meets RTP network data flow and there is URL(uniform resource locator) form; Check and finish to send the command format that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form; Judge to finish to send whether legally to meet RTP network data flow and there is the command format of HTTP request of URL(uniform resource locator) form, if so, reply the legal response of form, carry out this HTTP request, and detect the executing state of this HTTP request; If not, reply the illegal response of form; Detect and feed back and finish to send the executing state that meets RTP network data flow and there is the HTTP request of URL(uniform resource locator) form.
Preferably, send by specifying the 3rd port to send inquiry to network the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form; Wherein, inquiry required parameter that the HTTP that meets RTP network data stream mode and have a URL(uniform resource locator) form ask to provide is provided comprises from meeting the network data flow of RTP and have the general unique identifier obtaining the process that the HTTP of URL(uniform resource locator) form asks by specifying the first port to send to start to send to network; Resolve inquiry and send the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form; Check that inquiry sends the command format that meets RTP network data stream mode and have the HTTP request of URL(uniform resource locator) form; Whether meet RTP network data stream mode and have the command format of HTTP request of URL(uniform resource locator) form legal, if so, reply the legal response of form if judging that inquiry sends, carry out this HTTP request; If not, reply the illegal response of form; Detect also feedback query and send the executing state that meets RTP network data stream mode and there is the HTTP request of URL(uniform resource locator) form.
The present invention also provides a kind of service interface based on URL(uniform resource locator) in http protocol that system is provided on the other hand, comprise: client, for generating the HTTP request with URL(uniform resource locator) form, send the HTTP request with URL(uniform resource locator) form; And for detection of thering is the executing state of the HTTP request of URL(uniform resource locator) form with feedback; Server end, for receiving the HTTP request with URL(uniform resource locator) form, resolve the HTTP request with URL(uniform resource locator) form; Inspection has the command format of the HTTP request of URL(uniform resource locator) form; Whether the command format that judges the HTTP request with URL(uniform resource locator) form is legal, if, reply the legal response of form, carry out the HTTP request with URL(uniform resource locator) form, and obtain the executing state of the HTTP request with URL(uniform resource locator) form from described client; If not, reply the illegal response of form; Described server end has designated port; Wherein, described in there is URL(uniform resource locator) form HTTP request refer to the request head of http protocol, the HTTP request of URL(uniform resource locator) form can be expressed request task performed in service processes, and required parameter is provided; The executing state of the described HTTP request with URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP asks in the middle of operation and this HTTP request finishes to move.
Preferably, described designated port comprises the first port, the second port and the 3rd port, wherein, described client is sent and starts to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form to network by described the first port; Described client sends to finish to send to network by described the second port and meets RTP network data flow and have the HTTP request of URL(uniform resource locator) form or described client sends inquiry by described the 3rd port to network and sends the HTTP request that meets RTP network data stream mode and have URL(uniform resource locator) form.
As mentioned above, service interface supplying method and the system based on URL(uniform resource locator) in http protocol of the present invention, has following beneficial effect:
1, the present invention has utilized http protocol operating system independent, and any operating system can realize HTTP client and http server; Utilized the language independent of http protocol, HTTP client and http server can be realized in any language; Http protocol is network, so can conduct interviews between different processes.Similar provides a small amount of interface, and the media play service not being frequently used is used http protocol URL form that service interface is provided, and has realized spanning operation system platform, and across language, striding course, across file system, by realizing or quote complicated framework.
2, the present invention utilizes http protocol transmission not need transferring content, only needs the content of URL just can express interface content, and this service interface across language has very large practicality.
Embodiment
Below, by specific instantiation explanation embodiments of the present invention, those skilled in the art can understand other advantages of the present invention and effect easily by the disclosed content of this specification.The present invention can also be implemented or be applied by other different embodiment, and the every details in this specification also can be based on different viewpoints and application, carries out various modifications or change not deviating under spirit of the present invention.It should be noted that, in the situation that not conflicting, the feature in following examples and embodiment can combine mutually.
It should be noted that, the diagram providing in following examples only illustrates basic conception of the present invention in a schematic way, satisfy and only show with assembly relevant in the present invention in graphic but not component count, shape and size drafting while implementing according to reality, when its actual enforcement, kenel, quantity and the ratio of each assembly can be a kind of random change, and its assembly layout kenel also may be more complicated.
Embodiment mono-
The present embodiment provides a kind of service interface supplying method based on URL(uniform resource locator) in http protocol, be applied in the communication network of client and server end composition, refer to Fig. 1, be shown as the service interface supplying method flow chart based on URL(uniform resource locator) in http protocol, the described service interface supplying method based on URL(uniform resource locator) in http protocol comprises:
Step S1, described client sends the HTTP request with URL(uniform resource locator) form to network by designated port; The described HTTP request with URL(uniform resource locator) form refers to the request head of http protocol, and the HTTP request of URL(uniform resource locator) form can be expressed request task performed in service processes, and required parameter is provided.In step S1, also comprise the HTTP request with URL(uniform resource locator) form that generates; The HTTP request that generation has URL(uniform resource locator) form is to fill according to starting to send network data flow, end transmission network data flow or requester network data flow state demand the URL(uniform resource locator) part that HTTP asks, wherein, described URL(uniform resource locator) part comprises HTTP method, order line and parameter; Wherein HTTP method is GET method; Order line form is [client ip address]: [client port]/client service process.
Step S2, described server end is resolved the HTTP request with URL(uniform resource locator) form.The HTTP request that parsing has URL(uniform resource locator) form is beginning taking described GET method tail of string as order line, the ending taking question mark in described parameter as order line, parses client ip address, client port and client service process that described HTTP asks.Argument section be from? number start, character string HTTP/1.1 beginning is for ending, taking & as line of demarcation, each parameter represents with parameter item=parameter value respectively, therefore, starts to send data flow, finish to send data flow, query service status is all to represent with the form of parameter.
Step S3, described server end inspection has the command format of the HTTP request of URL(uniform resource locator) form;
Step S4, whether the command format that the HTTP that described server end judgement has URL(uniform resource locator) form asks is legal, if so, performs step S5; If not, execution step S7, replys the illegal response of form, then finishes process.Wherein, have described in judgement the command format of HTTP request of URL(uniform resource locator) form whether legal according to being whether to exist according to described request parameter, and parameter value be sky.
Step S5, described server end is replied the legal response of form to described client, and carries out the HTTP request with URL(uniform resource locator) form.
Step S6, described client detects and feeds back the extremely described server end of executing state of the HTTP request with URL(uniform resource locator) form.The executing state wherein, with the HTTP request of URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP asks in the middle of operation and this HTTP request finishes to move.
In abovementioned steps S1, described client sends the HTTP request with URL(uniform resource locator) form by the designated port on server end to network and comprises by the first port and send and start to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form to network; And meet RTP network data flow and there is the HTTP request of URL(uniform resource locator) form or send by specifying the 3rd port to send inquiry to network the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form by specifying the second port to send to finish to send to network.
Refer to 2, be shown as by specifying the first port to send and start to send the process that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form to network, wherein, start to send that required parameter that the HTTP that meets the network data flow of RTP and have a URL(uniform resource locator) form asks to provide comprises network data flow carrys out source file (file), the destination address (destip) that network data flow sends, the target port (desport) that network data flow sends, the encoding and decoding (codec) of network data current load, and whether network data flow needs circulation to send (loop).Start to send meet the network data flow of RTP and have URL(uniform resource locator) form HTTP request be designated start.This process specifically comprises:
Step S1 ', by specifying the first port to send and start to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form to network; Step S1 ' also comprises that generation starts to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form, according to the URL(uniform resource locator) part that starts the demand filling HTTP request that sends network data flow, wherein, described URL(uniform resource locator) part comprises HTTP method, order line and parameter; Value.
Step S2 ', resolves and starts to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form.It is beginning taking described GET method tail of string as order line that parsing starts to send the HTTP request that meets the network data flow of RTP and have a URL(uniform resource locator) form, the ending taking question mark in described parameter as order line, parses client ip address, client port and client service process that described HTTP asks.Argument section be from? number start, character string HTTP/1.1 beginning is ending, and taking & as line of demarcation, each parameter represents with parameter item=parameter value respectively.
Step S3 ', checks and starts to send the command format that meets the network data flow of RTP and have the HTTP request of URL(uniform resource locator) form;
Step S4 ', judges that whether the command format of this HTTP request is legal, if so, performs step S5 '; If not, perform step S7 ', reply the illegal response of form, end process.
Step S5 ', replys the legal response of form, carries out and starts to send the HTTP request that meets the network data flow of RTP and have URL(uniform resource locator) form, and obtain the general unique identifier of mark (UUID) that this HTTP request is carried out; Wherein, have described in judgement the command format of HTTP request of URL(uniform resource locator) form whether legal according to being whether to exist according to described request parameter, and parameter value be sky.With HTTP: // [MediaPlayIP]: [MediaPlayPort]/MediaPlay? cmd=start & file=busytone.wav & loop=1 & codec=g711a & destip=192.168.1.1 & destport=4000 is example, judge and in required parameter, whether have cmd=start and file, codec, destip, whether these four parameters of destport exist, and value is not empty, if cmd=start and file, codec, destip, these four parameters of destport all exist, and value is not empty, legal.
In the present embodiment, server end can the multiple tasks of concurrent execution, in order to identify the uniqueness of task, in the process that starts to send network data flow, can use UUID, this UUID is that the server program IP address, the port that use client-access, time three parameters of receiving request generate, and the algorithm of generation is UUID=client ip address character string+client port character string+receive time character string of request.
Step S6 ', detect and feed back and start to send the executing state that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form, this executing state comprises that this HTTP request does not bring into operation, this HTTP request in the middle of operation and this HTTP request finish operation.
By specifying the first port to send and start to send the HTTP that meets the network data flow of RTP and there is URL(uniform resource locator) form and ask taking table 1 as example to network:
Table 1: send and start to send the HTTP request embodiment that meets the network data flow of RTP and there is URL(uniform resource locator) form
Refer to 3, be shown as by specifying the second port to send and finish to send the process that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form to network, wherein, finishing to send required parameter that the HTTP that meets the network data flow of RTP and have a URL(uniform resource locator) form ask to provide comprises from meeting the network data flow of RTP and have the general unique identifier obtaining the process that the HTTP of URL(uniform resource locator) form asks by specifying the first port to send to start to send to network.Finish to send meet the network data flow of RTP and have URL(uniform resource locator) form HTTP request be designated stop.This process specifically comprises:
S1 ", by specifying the second port to send and finish to send the HTTP request that meets the network data flow of RTP and there is URL(uniform resource locator) form to network; Also comprising in this step generating and finish the HTTP request that transmission meets the network data flow of RTP and has URL(uniform resource locator) form, is to fill according to finishing to send network data flow demand the URL(uniform resource locator) part that HTTP asks,
S2 ", resolve and finish to send the HTTP request that meets the network data flow of RTP and there is URL(uniform resource locator) form;
S3 ", check and finish to send the command format that meets the network data flow of RTP and there is the HTTP request of URL(uniform resource locator) form;
S4 ", judge to finish to send whether legally to meet the network data flow of RTP and there is the command format of HTTP request of URL(uniform resource locator) form, if so, perform step S5 "; If not, perform step S7 ".
S5 ", reply the legal response of form, carry out this HTTP request.Wherein, finish to send that the executing state that meets the network data flow of RTP and have a HTTP request of URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP request in the middle of operation and this HTTP request finish operation.Meet the network data flow of RTP and there is the command format of HTTP request of URL(uniform resource locator) form HTTP when whether legal judging to finish to send: // [MediaPlayIP]: [MediaPlayPort]/MediaPlay? cmd=stop & uuid=2003 is example, judge in parameter and whether have cmd=stop and UUID to exist, and value is not empty.If cmd=stop, and UUID exist, and the value of UUID be sky, be legal.
S6 "; detect and feed back and finish to send the executing state that meets the network data flow of RTP and have the HTTP request of URL(uniform resource locator) form, this executing state comprises that this HTTP request does not bring into operation, this HTTP asks in the middle of operation and this HTTP request finishes to move.
S7 ", reply the illegal response of form, end process.
By specifying the second port to send and finish to send the HTTP that meets the network data flow of RTP and there is URL(uniform resource locator) form and ask taking table 2 as example to network:
Table 2: send and finish to send the HTTP request embodiment that meets the network data flow of RTP and there is URL(uniform resource locator) form
Refer to 4, be shown as by specifying the 3rd port to send inquiry to network and send the process that meets RTP network data stream mode and there is the HTTP request of URL(uniform resource locator) form, wherein, inquiry required parameter that the HTTP that meets RTP network data stream mode and have a URL(uniform resource locator) form ask to provide is provided comprises from meeting the network data flow of RTP and have the general unique identifier obtaining the process that the HTTP of URL(uniform resource locator) form asks by specifying the first port to send to start to send to network.Inquiry send meet RTP network data stream mode and have URL(uniform resource locator) form HTTP request be designated query.Described inquiry sends and meets RTP network data stream mode and comprise that inquiry sends and meet RTP network data flow.This process specifically comprises:
S1 " ', send by specifying the 3rd port to send inquiry to network the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form; Also comprise that in this step generated query sends the HTTP request that meets RTP network data stream mode and have URL(uniform resource locator) form, generated query sends the HTTP request that meets RTP network data stream mode and have URL(uniform resource locator) form, to send network data flow demand according to inquiry to fill the URL(uniform resource locator) part that HTTP asks, S2 " ', resolve inquiry and send the HTTP request that meets RTP network data stream mode and there is URL(uniform resource locator) form.
S3 " ', check that inquiry sends the command format that meets RTP network data stream mode and have the HTTP request of URL(uniform resource locator) form;
S4 " ', judge that inquiry sends and whether legally meet RTP network data stream mode and there is the command format of HTTP request of URL(uniform resource locator) form, if so, perform step S5 " '; If not, perform step S7 " '.Wherein, meet RTP network data stream mode and there is the command format of HTTP request of URL(uniform resource locator) form when whether legal judging that inquiry sends.
With HTTP: // [MediaPlayIP]: [MediaPlayPort]/MediaPlay? whether cmd=Query & uuid=2003 is example, judge in parameter and have cmd=query and UUID to exist, and value is not empty.If cmd=stop, and UUID exist, and the value of UUID be sky, be legal.
S5 " ', reply the legal response of form, carry out this HTTP request.
S6 " ', detect also feedback query and send the executing state that meets RTP network data stream mode and there is the HTTP request of URL(uniform resource locator) form.Wherein, inquiry send that the executing state that meets RTP network data stream mode and have a HTTP request of URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP request in the middle of operation and this HTTP request finish operation.
S7 " ', reply the illegal response of form, end process.
By specify the 3rd port to network send inquiry send meet RTP network data stream mode and have URL(uniform resource locator) form HTTP request taking table 3 as example:
Table 3: send inquiry and send the HTTP request embodiment that meets RTP network data stream mode and there is URL(uniform resource locator) form
The present embodiment also provides a kind of service interface based on URL(uniform resource locator) in http protocol that system is provided, refer to Fig. 5, the service interface being shown as based on URL(uniform resource locator) in http protocol provides system principle structure chart, and described service interface provides system 1 to comprise client 11 and server end 12.
Client 11 is for generating the HTTP request with URL(uniform resource locator) form, send the HTTP request with URL(uniform resource locator) form; And for detection of thering is the executing state of the HTTP request of URL(uniform resource locator) form with feedback.The HTTP wherein, with URL(uniform resource locator) form asks to comprise and starts to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form; Finish to send the HTTP request that meets RTP network data flow and there is URL(uniform resource locator) form, or inquiry sends the HTTP request that meets RTP network data stream mode and have URL(uniform resource locator) form.Wherein, described in there is URL(uniform resource locator) form HTTP request refer to the request head of http protocol, the HTTP request of URL(uniform resource locator) form can be expressed request task performed in service processes, and required parameter is provided.
Server end 12 is for receiving the HTTP request with URL(uniform resource locator) form, resolve the HTTP request with URL(uniform resource locator) form; Inspection has the command format of the HTTP request of URL(uniform resource locator) form; Judge that whether it is legal, if so, reply the legal response of form to described client 11, carry out the HTTP request with URL(uniform resource locator) form, and obtain the executing state of the HTTP request with URL(uniform resource locator) form from described client 11; If not, reply the illegal response of form.
Described server end 12 has designated port.Described designated port comprises the first port 121, the second port one 22 and the 3rd port one 23, wherein, described client 11 is sent and starts to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form to network by described the first port 121; Described client 11 is sent and finishes to send the HTTP request that meets RTP network data flow and have URL(uniform resource locator) form to network by described the second port one 22, or described client sends the HTTP request that meets RTP network data stream mode and have URL(uniform resource locator) form that sends of inquiring about to described the 3rd port one 23 to network.The executing state of the described HTTP request with URL(uniform resource locator) form comprises that this HTTP request does not bring into operation, this HTTP asks in the middle of operation and this HTTP request finishes to move.
Service interface supplying method and system based on URL(uniform resource locator) in http protocol of the present invention utilized http protocol operating system independent, and any operating system can realize HTTP client and http server; Utilized the language independent of http protocol, HTTP client and http server can be realized in any language; Http protocol is network, so can conduct interviews between different processes.Similar provides a small amount of interface, and the media play service not being frequently used is used http protocol URL form that service interface is provided, and has realized spanning operation system platform, and across language, striding course, across file system, by realizing or quote complicated framework.And HTTP transmission does not need transferring content, only needs the content of URL just can express interface content, and this service interface across language has very large practicality.
So the present invention has effectively overcome various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all can, under spirit of the present invention and category, modify or change above-described embodiment.Therefore, such as in affiliated technical field, have and conventionally know that the knowledgeable, not departing from all equivalence modifications that complete under disclosed spirit and technological thought or changing, must be contained by claim of the present invention.