The content of the invention
In view of the foregoing deficiencies of prior art, it is an object of the invention to provide one kind based on unified in http protocol
The service interface providing method and system of Resource Locator, for solving to provide the network number for meeting Real-time Transport Protocol in the prior art
Module interface according to stream broadcasting service is few, and function is simple, and called frequency is low and is limited in a small range use, and the module
It can not be by different processes, the problem of different file, different language, the module accesses of different platform.
In order to achieve the above objects and other related objects, one aspect of the present invention provides a kind of based on unified money in http protocol
The service interface providing method of source finger URL, applied to client and server end composition communication network in, including:Pass through finger
Fixed end mouthful sends the HTTP request with uniform resource locator form to network, described with uniform resource locator form
HTTP request refers to the request header of http protocol, and the HTTP request of uniform resource locator form can be expressed in service processes
Performed request task, provides required parameter;HTTP request of the parsing with uniform resource locator form, and check have
The command format of the HTTP request of uniform resource locator form is to judge whether it is legal, if so, the legal response of form is replied,
Perform the HTTP request with uniform resource locator form;If it is not, then reply the illegal response of form;Detecting and feeding back has
The execution state of the HTTP request of uniform resource locator form;Wherein, the HTTP with uniform resource locator form
The execution state of request does not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminates
Operation.
Preferably, the step of sending the HTTP request with uniform resource locator form to network by designated port is gone back
Including generating the HTTP request with uniform resource locator form;HTTP request of the generation with uniform resource locator form
It is according to starting to send network data flow, terminate to send network data flow or inquiry network data flow status requirements filling HTTP
The uniform resource locator part of request, wherein, the uniform resource locator part includes HTTP method, order line and ginseng
Number;Wherein HTTP method is GET methods;Order row format is [client ip address]:[client port]/client service into
Journey.
Preferably, HTTP request of the parsing with uniform resource locator form is with the GET methods tail of string
For order line start, using question mark in the parameter as order line endings, client ip address, the visitor of the HTTP request are parsed
Family end port and client service process.
Preferably, judge the HTTP request with uniform resource locator form command format it is whether legal according to
According to being whether there is according to the required parameter, and parameter value is not sky.
Preferably, sending the HTTP request with uniform resource locator form to network by designated port includes:It is logical
It crosses specified first port and sends to start to send to network and meet real-time transport protocol network data flow and with unified resource positioning
Accord with the HTTP request of form;And meet real-time transport protocol network data by the way that second port is specified to send to terminate to send to network
It flows and has the HTTP request of uniform resource locator form or met by the way that third port is specified to send inquiry transmission to network
Real-time transport protocol network data stream mode and the HTTP request with uniform resource locator form.
Preferably, start to send the network data flow for meeting real-time transport protocol by the way that first port is specified to send to network
And the HTTP request with uniform resource locator form;Wherein, start to send the network data flow for meeting real-time transport protocol
And the required parameter of the HTTP request offer with uniform resource locator form includes source files, the network of network data flow
Target port, the encoding and decoding of network data current load and the network number that the destination address of data flow transmission, network data flow are sent
Whether need to cycle through according to stream;Parsing starts to send the network data flow for meeting real-time transport protocol and determine with unified resource
The HTTP request of position symbol form;It checks and starts to send the network data flow for meeting real-time transport protocol and be positioned with unified resource
Accord with the command format of the HTTP request of form;Judge to start to send the network data flow for meeting real-time transport protocol and have unified
Whether the command format of the HTTP request of Resource Locator form is legal, if so, replying the legal response of form, execution starts to send
Meet the network data flow of real-time transport protocol and the HTTP request with uniform resource locator form, and obtain the HTTP and ask
Seek the mark Universally Unique Identifier of execution;If it is not, then reply the illegal response of form;It detects and feeds back to start to send and meet reality
When transport protocol network data flow and with uniform resource locator form HTTP request execution state.
Preferably, by specify second port to network send terminate send meet real-time transport protocol network data flow and
HTTP request with uniform resource locator form;Wherein, terminate to send to meet real-time transport protocol network data flow and tool
The required parameter that the HTTP request for having uniform resource locator form provides is included from by the way that first port is specified to be sent to network
Start the process for sending the network data flow for meeting real-time transport protocol and the HTTP request with uniform resource locator form
The Universally Unique Identifier of middle acquisition;Parsing, which terminates to send, to be met real-time transport protocol network data flow and determines with unified resource
The HTTP request of position symbol form;It checks and terminates to send the network data flow for meeting real-time transport protocol and be positioned with unified resource
Accord with the command format of the HTTP request of form;Judge to terminate to send to meet real-time transport protocol network data flow and with unified money
Whether the command format of the HTTP request of source finger URL form is legal, if so, replying the legal response of form, performing the HTTP please
It asks, and detects the execution state of the HTTP request;If it is not, then reply the illegal response of form;It detects and feeds back end and send symbol
Close the execution state of real-time transport protocol network data flow and the HTTP request with uniform resource locator form.
Preferably, real-time transport protocol network data flow shape is met by the way that third port is specified to send inquiry to network and send
State and the HTTP request with uniform resource locator form;Wherein, inquiry, which is sent, meets real-time transport protocol network data flow
State and with uniform resource locator form HTTP request provide required parameter include from by specify first port to
Network transmission starts to send the network data flow for meeting real-time transport protocol and has the HTTP of uniform resource locator form please
The Universally Unique Identifier obtained during asking;Parsing inquiry, which is sent, meets real-time transport protocol network data stream mode and tool
There is the HTTP request of uniform resource locator form;It checks that inquiry is sent and meets real-time transport protocol network data stream mode and tool
There is the command format of the HTTP request of uniform resource locator form;Judge that inquiry is sent and meet real-time transport protocol network data
Stream mode and with uniform resource locator form HTTP request command format it is whether legal, if so, reply form it is legal
Response, performs the HTTP request;If it is not, then reply the illegal response of form;It detects and feedback query transmission meets real-time Transmission
Protocol network data flow state and with uniform resource locator form HTTP request execution state.
Another aspect of the present invention also provides a kind of service interface based on uniform resource locator in http protocol and provides system
System, including:Client, for generating the HTTP request with uniform resource locator form, sending has unified resource positioning
Accord with the HTTP request of form;And the execution state for detecting and feeding back the HTTP request with uniform resource locator form;
Server end, for receiving the HTTP request with uniform resource locator form, parsing has uniform resource locator form
HTTP request;Check the command format of the HTTP request with uniform resource locator form;Judge to determine with unified resource
Whether the command format of the HTTP request of position symbol form is legal, if so, replying the legal response of form, performs and determines with unified resource
Position accords with the HTTP request of form, and the execution shape of the HTTP request with uniform resource locator form is obtained from the client
State;If it is not, then reply the illegal response of form;The server end has designated port;Wherein, it is described to determine with unified resource
The HTTP request of position symbol form refers to the request header of http protocol, and the HTTP request of uniform resource locator form can be expressed
Performed request task, provides required parameter in service processes;The HTTP request with uniform resource locator form
Execution state do not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminates to run.
Preferably, the designated port includes first port, second port and third port, wherein, the client is led to
It crosses the first port and sends to start to send to network and meet real-time transport protocol network data flow and with unified resource positioning
Accord with the HTTP request of form;The client sends to terminate to send to network by the second port meets real-time transport protocol
Network data flow and HTTP request with uniform resource locator form or the client are by the third port to net
Network, which sends inquiry and sends, to be met real-time transport protocol network data stream mode and has the HTTP of uniform resource locator form please
It asks.
As described above, the service interface providing method based on uniform resource locator in http protocol of the present invention and being
System, has the advantages that:
1st, present invention utilizes http protocol operating system independence, any operating system can realize HTTP clients
And HTTP server;The language independence of http protocol is make use of, any language can realize HTTP clients and HTTP clothes
Business device;Http protocol is network-based, so can access between different processes.It is similar that a small amount of interface is only provided, no
The media playback service being frequently used provides service interface using http protocol URL format, that is, realizes cross operating system and put down
Platform, across language, striding course, across file system, by not having to realize or quoting complicated frame.
2nd, transferring content is not required using http protocol transmission in the present invention, it is only necessary to which the content of URL can express interface
Content, this service interface across language have very big practicability.
Embodiment one
The present embodiment provides a kind of service interface providing methods based on uniform resource locator in http protocol, are applied to
In the communication network of client and server end composition, referring to Fig. 1, being shown as based on uniform resource locator in http protocol
Service interface providing method flow chart, the service interface providing method bag based on uniform resource locator in http protocol
It includes:
Step S1, the client sends the HTTP with uniform resource locator form by designated port to network please
It asks;The HTTP request with uniform resource locator form refers to the request header of http protocol, uniform resource locator
The HTTP request of form can express request task performed in service processes, provide required parameter.It also wraps in step sl
Include HTTP request of the generation with uniform resource locator form;There is the HTTP request of uniform resource locator form to be for generation
It is asked according to transmission network data flow, end transmission network data flow or inquiry network data flow status requirements filling HTTP is started
The uniform resource locator part asked, wherein, the uniform resource locator part includes HTTP method, order line and parameter;
Wherein HTTP method is GET methods;Order row format is [client ip address]:[client port]/client service process.
Step S2, the HTTP request of the server end parsing with uniform resource locator form.Parsing has unified
The HTTP request of Resource Locator form is using the GET methods tail of string as order line start, to be asked in the parameter
Number for order line endings, the client ip address, client port and client service process of the HTTP request are parsed.
Argument section be fromNumber start, character string HTTP/1.1 beginning for ending, using & as line of demarcation, each parameter is respectively with parameter item
=parameter value represents, therefore, starts to send data flow, terminates to send data flow, query service status is all the shape with parameter
Formula represents.
Step S3, the server end inspection have the command format of the HTTP request of uniform resource locator form;
Step S4, whether the command format of the HTTP request of the server end judgement with uniform resource locator form
It is legal, if so, performing step S5;If it is not, performing step S7, that is, the illegal response of form is replied, then terminates process.Wherein,
The whether legal foundation of the command format of HTTP request with uniform resource locator form described in judging is please according to
Parameter is asked to whether there is, and parameter value is not sky.
Step S5, the server end replys the legal response of form to the client, and performs and determine with unified resource
The HTTP request of position symbol form.
Step S6, the client detect and feed back the execution state of the HTTP request with uniform resource locator form
To the server end.Wherein, the execution state of the HTTP request with uniform resource locator form includes the HTTP
Request does not bring into operation, the HTTP request is among operation and the HTTP request terminates to run.
In abovementioned steps S1, the client is sent by the designated port on server end to network has unified resource
The HTTP request of finger URL form includes starting to send to network transmission by first port meeting real-time transport protocol network number
According to the HTTP request for flowing and having uniform resource locator form;And terminate to send symbol by the way that second port is specified to send to network
Close real-time transport protocol network data flow and with uniform resource locator form HTTP request or pass through specify third port
Meet real-time transport protocol network data stream mode to network transmission inquiry transmission and there is uniform resource locator form
HTTP request.
2 are referred to, is shown as starting to send the net for meeting real-time transport protocol by the way that first port is specified to send to network
Network data flow and with uniform resource locator form HTTP request process, wherein, start send meet real-time Transmission association
The network data flow of view and the required parameter that there is the HTTP request of uniform resource locator form to provide include network data flow
Source files (file), network data flow send destination address (destip), network data flow send target port
(desport), whether the encoding and decoding (codec) of network data current load and network data flow need to cycle through (loop).It opens
It originates and the network data flow for meeting real-time transport protocol and the HTTP request with uniform resource locator form is sent to be identified as
start.The process specifically includes:
Step S1 ' starts to send the network data for meeting real-time transport protocol by the way that first port is specified to send to network
Stream and the HTTP request with uniform resource locator form;Step S1 ' further include generation start send meet real-time Transmission association
The network data flow of view and the HTTP request with uniform resource locator form are according to the need for starting transmission network data flow
The uniform resource locator part of filling HTTP request is asked, wherein, the uniform resource locator part includes HTTP method, life
Order row and parameter;Value.
Step S2 ', parsing start to send the network data flow for meeting real-time transport protocol and have uniform resource locator
The HTTP request of form.Parsing starts to send the network data flow for meeting real-time transport protocol and has uniform resource locator lattice
The HTTP request of formula is using the GET methods tail of string as order line start, using question mark in the parameter as order line knot
Tail parses the client ip address, client port and client service process of the HTTP request.Argument section be from
Number start, character string HTTP/1.1 beginning for ending, using & as line of demarcation, each parameter carrys out table with parameter item=parameter value respectively
Show.
Step S3 ' is checked and is started to send the network data flow for meeting real-time transport protocol and have uniform resource locator
The command format of the HTTP request of form;
Step S4 ' judges whether the command format of the HTTP request is legal, if so, performing step S5 ';If it is not, it then performs
Step S7 ' replys the illegal response of form, terminates process.
Step S5 ' replys the legal response of form, performs and starts to send the network data flow and tool for meeting real-time transport protocol
There is the HTTP request of uniform resource locator form, and obtain the mark Universally Unique Identifier of HTTP request execution
(UUID);Wherein, the whether legal foundation of the command format of the HTTP request with uniform resource locator form is judged
It is that whether there is according to the required parameter, and parameter value is not sky.With HTTP://[MediaPlayIP]:
[MediaPlayPort]/MediaPlayCmd=start&file=busytone.wav&loop=1&codec=g711a&
Exemplified by destip=192.168.1.1&destport=4000, judge whether to have in required parameter cmd=start and
This four parameters of file, codec, destip, destport whether there is, and be worth for sky, if cmd=start and
This four parameters of file, codec, destip, destport all exist, and are worth not for sky, then are legal.
In the present embodiment, server end can concurrently perform multiple tasks, in order to identify the uniqueness of task, start to send out
It is that server program uses the IP address of client access, end that UUID, this UUID can be used during SCN Space Cable Network data flow
Mouthful, receive three parameters of time generation of request, the algorithm of generation is UUID=client ip address character string+client end
The time character string of mouthful character string+receive request.
Step S6 ', detects and feeds back and start to send the network data flow that meets real-time transport protocol and with unified resource
The execution state of the HTTP request of finger URL form, which does not bring into operation including the HTTP request, the HTTP request
Among operation and the HTTP request terminates to run.
Start to send to network transmission by specified first port and meet the network data flow of real-time transport protocol and have
The HTTP request of uniform resource locator form is by taking table 1 as an example:
Table 1:It sends and starts to send the network data flow for meeting real-time transport protocol and there is uniform resource locator form
HTTP request embodiment
3 are referred to, is shown as terminating to send the net for meeting real-time transport protocol by the way that second port is specified to send to network
Network data flow and with uniform resource locator form HTTP request process, wherein, terminate send meets real-time Transmission association
The network data flow of view and the required parameter that there is the HTTP request of uniform resource locator form to provide are included from by specifying
First port starts to send the network data flow for meeting real-time transport protocol and with uniform resource locator lattice to network transmission
The Universally Unique Identifier obtained during the HTTP request of formula.Terminate to send the network data flow for meeting real-time transport protocol
And the HTTP request with uniform resource locator form is identified as stop.The process specifically includes:
S1 ", by specify second port to network send terminate send meet real-time transport protocol network data flow and
HTTP request with uniform resource locator form;Generation end is further included in this step and is sent meets real-time transport protocol
Network data flow and with uniform resource locator form HTTP request, be according to terminate send network data flow demand fill out
The uniform resource locator part of HTTP request is filled,
S2 ", parsing terminate to send the network data flow for meeting real-time transport protocol and have uniform resource locator form
HTTP request;
S3 " is checked and is terminated to send the network data flow for meeting real-time transport protocol and have uniform resource locator form
HTTP request command format;
S4 " judges to terminate to send the network data flow for meeting real-time transport protocol and has uniform resource locator form
HTTP request command format it is whether legal, if so, performing step S5 ";If it is not, then perform step S7 ".
S5 " replys the legal response of form, performs the HTTP request,.Wherein, terminate to send to meet real-time transport protocol
Network data flow and the execution state of HTTP request with uniform resource locator form do not start to transport including the HTTP request
Row, the HTTP request is among operation and the HTTP request terminates to run.Judging to terminate to send to meet real-time transport protocol
Network data flow and with uniform resource locator form HTTP request command format it is whether legal when HTTP://
[MediaPlayIP]:[MediaPlayPort]/MediaPlayExemplified by cmd=stop&uuid=2003, judge be in parameter
It is no with the presence of cmd=stop and UUID, and be worth for sky.If cmd=stop, and UUID exists, and the value of UUID is not sky,
It is then legal.
S6 " is detected and fed back and terminates to send the network data flow for meeting real-time transport protocol and be positioned with unified resource
The execution state of the HTTP request of form is accorded with, which does not bring into operation including the HTTP request, the HTTP request is being transported
In the trade and the HTTP request terminates to run.
S7 " replys the illegal response of form, terminates process.
By the way that second port is specified to meet the network data flow of real-time transport protocol to network transmission end transmission and is had
The HTTP request of uniform resource locator form is by taking table 2 as an example:
Table 2:It sends and terminates to send the network data flow for meeting real-time transport protocol and there is uniform resource locator form
HTTP request embodiment
4 are referred to, is shown as meeting real-time transport protocol network by the way that third port is specified to send inquiry to network and send
Data flow state and with uniform resource locator form HTTP request process, wherein, inquiry send meets real-time Transmission
The required parameter that protocol network data flow state and HTTP request with uniform resource locator form provide is included from passing through
First port is specified to start to send the network data flow for meeting real-time transport protocol and with unified resource positioning to network transmission
The Universally Unique Identifier obtained during the HTTP request for according with form.Inquiry, which is sent, meets real-time transport protocol network data
Stream mode and HTTP request with uniform resource locator form are identified as query.The inquiry, which is sent, meets real-time biography
Defeated protocol network data flow state includes inquiry transmission and meets real-time transport protocol network data flow.The process specifically includes:
S1 " ' meets real-time transport protocol network data stream mode by the way that third port is specified to send inquiry to network and send
And the HTTP request with uniform resource locator form;Generation inquiry is further included in this step and is sent meets real-time Transmission association
Network data stream mode and the HTTP request with uniform resource locator form are discussed, generation inquiry, which is sent, meets real-time Transmission association
Network data stream mode and the HTTP request with uniform resource locator form are discussed, is that network data flow need are sent according to inquiry
The uniform resource locator part of filling HTTP request is asked, S2 " ', parsing inquiry, which is sent, meets real-time transport protocol network data
Stream mode and the HTTP request with uniform resource locator form.
S3 " ' checks that inquiry is sent and meets real-time transport protocol network data stream mode and with uniform resource locator lattice
The command format of the HTTP request of formula;
S4 " ' judges that inquiry is sent and meets real-time transport protocol network data stream mode and with uniform resource locator lattice
Whether the command format of the HTTP request of formula is legal, if so, performing step S5 " ';If it is not, then perform step S7 " '.Wherein,
Meet real-time transport protocol network data stream mode in judgement inquiry transmission and have the HTTP of uniform resource locator form please
When whether the command format asked is legal.
With HTTP://[MediaPlayIP]:[MediaPlayPort]/MediaPlayCmd=Query&uuid=
Exemplified by 2003, judge whether with the presence of cmd=query and UUID in parameter, and be worth not for sky.If cmd=stop, and UUID
In the presence of, and the value of UUID is not sky, then is legal.
S5 " ' replys the legal response of form, performs the HTTP request.
S6 " ', is detected and feedback query transmission meets real-time transport protocol network data stream mode and determines with unified resource
The execution state of the HTTP request of position symbol form.Wherein, inquiry, which is sent, meets real-time transport protocol network data stream mode and tool
The execution state for having the HTTP request of uniform resource locator form does not bring into operation including the HTTP request, the HTTP request exists
Among operation and the HTTP request terminates to run.
S7 " ' replys the illegal response of form, terminates process.
Meet real-time transport protocol network data stream mode and tool by the way that third port is specified to send inquiry to network and send
Have the HTTP request of uniform resource locator form by taking table 3 as an example:
Table 3:It sends inquiry and sends and meet real-time transport protocol network data stream mode and with uniform resource locator lattice
The HTTP request embodiment of formula
The present embodiment also provides a kind of service interface based on uniform resource locator in http protocol and provides system, please join
Fig. 5 is read, the service interface based on uniform resource locator in http protocol is shown as and system principle structure chart, the service is provided
Interface, which provides system 1, includes client 11 and server end 12.
For client 11 for generating the HTTP request with uniform resource locator form, sending has unified resource positioning
Accord with the HTTP request of form;And the execution state for detecting and feeding back the HTTP request with uniform resource locator form.
Wherein, the HTTP request with uniform resource locator form includes starting to send meeting real-time transport protocol network data
Stream and the HTTP request with uniform resource locator form;Terminate to send and meet real-time transport protocol network data flow and have
The HTTP request of uniform resource locator form or inquiry, which are sent, meets real-time transport protocol network data stream mode and with system
The HTTP request of one Resource Locator form.Wherein, the HTTP request with uniform resource locator form refers to HTTP
The request header of agreement, the HTTP request of uniform resource locator form can express request performed in service processes and appoint
Business, provides required parameter.
Server end 12 is parsed and determined with unified resource for receiving the HTTP request with uniform resource locator form
The HTTP request of position symbol form;Check the command format of the HTTP request with uniform resource locator form;Whether judge it
Legal, if so, replying the legal response of form to the client 11, performing the HTTP with uniform resource locator form please
It asks, and the execution state of the HTTP request with uniform resource locator form is obtained from the client 11;If it is not, it then replys
The illegal response of form.
The server end 12 has designated port.The designated port include first port 121, second port 122 and
Third port 123, wherein, the client 11 starts to send by the first port 121 to network transmission meets real-time biography
Defeated protocol network data flow and the HTTP request with uniform resource locator form;The client 11 passes through the second end
Mouth 122 meets real-time transport protocol network data flow to network transmission end transmission and has uniform resource locator form
HTTP request or the client send inquiry and send to the third port 123 to network meets real-time transport protocol network
Data flow state and the HTTP request with uniform resource locator form.The HTTP with uniform resource locator form
The execution state of request does not bring into operation including the HTTP request, the HTTP request is among operation and the HTTP request terminates
Operation.
Service interface providing method and system of the present invention based on uniform resource locator in http protocol utilize
Http protocol operating system independence, any operating system can realize HTTP clients and HTTP server;It make use of
The language independence of http protocol, any language can realize HTTP clients and HTTP server;Http protocol is to be based on
Network, so can access between different processes.It is similar that a small amount of interface is only provided, the media play not being frequently used
Service provides service interface using http protocol URL format, that is, spanning operation system platform is realized, across language, striding course, across text
Part system, by not having to realize or quoting complicated frame.And transferring content is not required in HTTP transmission, it is only necessary to the content of URL
Portal contents can be expressed, this service interface across language has very big practicability.
So the present invention effectively overcomes various shortcoming of the prior art and has high industrial utilization.
The above-described embodiments merely illustrate the principles and effects of the present invention, and is not intended to limit the present invention.It is any ripe
Know the personage of this technology all can carry out modifications and changes under the spirit and scope without prejudice to the present invention to above-described embodiment.Cause
This, those of ordinary skill in the art is complete without departing from disclosed spirit and institute under technological thought such as
Into all equivalent modifications or change, should by the present invention claim be covered.