A kind of Web Service availability tracking detection method, Apparatus and system
Technical field
The application relates to the network application field, particularly relates to a kind of Web Service service availability tracking detection method, Apparatus and system based on OSGI.
Background technology
Web Service is the distributed computing technology of loose coupling, platform independence, language independent, in distributed system, each distributed component very important synchronously, when a Web Service serves when unavailable, to in time notify and to use or use consumer's current service of this service unavailable, the consumer must wait for that service is available or handle the unusual of service call failure, but and can use when consumer's current service of service time spent notification service, the consumer can call service function.
The inventor is through discovering also do not have perfect method that Web Service is effectively followed the tracks of detection in the prior art, effectively Web Service carried out availability to follow the tracks of the method that detects be a problem demanding prompt solution so provide a kind of.
Summary of the invention
For solving the problems of the technologies described above, the embodiment of the present application provides a kind of Web Service availability based on OSGI to follow the tracks of and detects detection method, Apparatus and system, under the computing environment of OSGI normalized definition, Web Service is carried out effective availability follow the tracks of detection.
Technical scheme is as follows:
A kind of Web Service availability tracking detection method comprises:
Obtain WSDL (the Web Services Description Language of Web Service issue, be a kind of XML language how Web service and explanation communicate by letter with Web service that is used for describing) address of document, create the resource connecting object of described address of document, using described resource connecting object is connected with the WSDL document of Web Service issue, if connect unusual, then Web Service service is unavailable, otherwise, obtain described WSDL document;
Search the Web Service address of service of appointment in the described WSDL document, create the resource connecting object of described address of service, use described resource connecting object and be connected with Web Service, if connect unusual, then Web Service service is unavailable, otherwise Web Service service is available.
Above-mentioned method, preferred, described application resource connecting object with the process that the WSDL document of Web Service issue is connected is:
Obtain the address of Web Service by the WSDL document of HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)) protocol issuance;
Create the HTTP resource connecting object of described WSDL address of document;
Using described HTTP resource connecting object is connected with described WSDL document.
Above-mentioned method, preferred, described application resource connecting object with the process that the WSDL document of Web Service issue is connected is:
Obtain the address of Web Service by the WSDL document of HTTPS (Hypertext Transfer Protocol over Secure Socket Layer is the HTTP passage of target with safety) protocol issuance;
Create the HTTPS resource connecting object of described WSDL address of document;
Using described HTTPS resource connecting object is connected with described WSDL document.
Above-mentioned method, preferred, described application resource connecting object is specially with the process that Web Service is connected:
Search the Web Service address of service of appointment in the described WSDL document;
Create the HTTP resource connecting object of described address of service;
Using described HTTP resource connecting object is connected with Web Service.
Above-mentioned method, preferred, described application resource connecting object is specially with the process that Web Service is connected:
Search the Web Service address of service of appointment in the described WSDL document;
Create the HTTPS resource connecting object of described address of service;
Using described HTTPS resource connecting object is connected with Web Service.
A kind of Web Service availability tracing and detecting apparatus comprises: first address acquisition unit, the first resource connecting object creating unit, first linkage unit, second address acquisition unit, the second resource connecting object creating unit and second linkage unit;
Wherein: described first address acquisition unit is used to obtain the address of WSDL (Web Services Description Language is that a kind of being used for described Web service and the XML language of how to communicate by letter with the Web service is described) document of Web Service issue;
The first resource connecting object creating unit is used for the address of the document that obtains according to described first address acquisition unit, creates the resource connecting object of described address of document;
Described first linkage unit is used to use described first resource and connects the resource connecting object that creating unit creates and be connected with the WSDL document that Web Service issues, if connect unusual, then Web Service service is unavailable, otherwise, obtain described WSDL document;
Described second address acquisition unit is used for searching the Web Service address of service of the WSDL document appointment that described first linkage unit obtains;
The described second resource connecting object creating unit is used for creating according to the address of service that described second address acquisition unit is searched the resource connecting object of described address of service;
Described second linkage unit is used to use the resource connecting object that the described second resource connecting object creating unit creates and is connected with Web Service, if connect unusually, then Web Service service is unavailable, otherwise Web Service serves available.
Above-mentioned device, preferred, the described first resource connecting object creating unit comprises: a HTTP resource object creates assembly and a HTTPS resource object is created assembly;
Wherein: a described HTTP resource object is created assembly and is used to create the HTTP resource connecting object of Web Service by the address of the WSDL document of http protocol issue;
A described HTTPS resource object is created assembly and is used to create the HTTPS resource connecting object of Web Service by the address of the WSDL document of HTTPS protocol issuance.
Above-mentioned device, preferred, the described second resource connecting object creating unit comprises: the 2nd HTTP resource object creates assembly and the 2nd HTTPS resource object is created assembly;
Described the 2nd HTTP resource object is created assembly and is used to create the HTTP resource connecting object of Web Service by the address of service of http protocol issue;
Described the 2nd HTTPS resource object is created assembly and is used to create the HTTPS resource connecting object of Web Service by the address of service of HTTPS protocol issuance.
A kind of Web Service availability is followed the tracks of detection system, comprising: client, a kind of Web Service of application end availability tracing and detecting apparatus.
The technical scheme that is provided by above the embodiment of the present application as seen, Web Service service availability tracking detection method, Apparatus and system based on OSGI provided by the invention, obtain the address of the WSDL document of Web Service issue, create the resource connecting object of described address of document, using described resource connecting object is connected with the WSDL document of Web Service issue, if connect and showing that current Web Service is unavailable unusually, otherwise, read the WSDL document and be cached to this locality; Obtain the Web Service address of service in the WSDL document then, create the resource connecting object of address of service, use described resource connecting object and be connected with Web Service, if connect unusual, then current Web Service is unavailable, otherwise Web Service can use.
By above argumentation as can be known, Web Service service availability tracking detection method, Apparatus and system that the embodiment of the present application provides, successively the WSDL document to Web Service issue is connected with the Web Service of appointment in the WSDL document, have only in the time all can connecting, show that just current Web Service service is available, notify the user to use; This method is a cyclic process to the tracking detection of Web Service, at set intervals the availability of Web Service is followed the tracks of detection, the operating position of real-time informing user current Web Service has effectively realized the real-time tracking of Web Service availability is detected.
Description of drawings
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, the accompanying drawing that describes below only is some embodiment that put down in writing among the application, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
The method flow diagram of a kind of Web Service availability tracking detection method that Fig. 1 provides for the embodiment of the present application;
The flow chart that the application resource connecting object that Fig. 2 provides for the embodiment of the present application is connected with the WSDL document of Web Service issue;
Fig. 3 is connected another flow chart for the application resource connecting object that the embodiment of the present application provides with the WSDL document of Web Service issue;
The flow chart that the application resource connecting object that Fig. 4 provides for the embodiment of the present application is connected with Web Service;
The another flow chart that the application resource connecting object that Fig. 5 provides for the embodiment of the present application is connected with Web Service;
The structural representation of a kind of Web Service availability tracing and detecting apparatus that Fig. 6 provides for the embodiment of the present application;
One detailed structure schematic diagram of a kind of Web Service availability tracing and detecting apparatus that Fig. 7 provides for the embodiment of the present application;
The another detailed structure schematic diagram of a kind of Web Service availability tracing and detecting apparatus that Fig. 8 provides for the embodiment of the present application;
Fig. 9 follows the tracks of the structural representation of detection system for a kind of Web Service availability that the embodiment of the present application provides.
Embodiment
The embodiment of the present application provides a kind of Web Service availability tracking detection method, Apparatus and system, to judging that the foundation that a Web Service can use is, the WSDL document of Web Service issue can with and the WSDL document in the Web Service address of appointment can use, it is available to satisfy i.e. this Web Service service of above condition.
More than be the application's core concept, understand the application's scheme better in order to make those skilled in the art person.Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment only is the application's part embodiment, rather than whole embodiment.Based on the embodiment among the application, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all should belong to the scope of the application's protection.
The method flow diagram of a kind of Web Service availability tracking detection method that the embodiment of the present application provides comprises as shown in Figure 1:
Step S101: the address that obtains the WSDL document of Web Service issue;
Step S102: create the resource connecting object of WSDL address of document, use above-mentioned resource connecting object and be connected with the WSDL document of Web Service issue;
Step S103: judge whether above-mentioned resource connecting object is unusual with being connected of WSDL document; If, execution in step S109; Otherwise execution in step S104;
Step S104: the WSDL document that obtains above-mentioned Web Service issue;
Step S105: the Web Service address of service of searching appointment in the above-mentioned WSDL document;
Step S106: create the resource connecting object of above-mentioned address of service, use above-mentioned resource connecting object and be connected with Web Service;
Step S107: whether the resource connecting object of judging the Web Service address of service of creating is unusual with being connected of Web Service, if, execution in step S109; Otherwise, execution in step S108;
Step S108: it is current available to notify user Web Service to serve;
Step S109: it is current unavailable to notify user Web Service to serve.
The resource connecting object of address of creating the WSDL document of Web Service issue comprises two types of HTTP and HTTPS; Web Service can be by http protocol and HTTPS agreement dual mode issue WSDL document.
When Web Service issued the WSDL document by http protocol, the flow chart that the application resource connecting object that the embodiment of the present application provides is connected with the WSDL document of Web Service issue comprised as shown in Figure 2:
Step S201: obtain the address of Web Service by the WSDL document of http protocol issue;
Step S202: the HTTP resource connecting object of creating above-mentioned WSDL address of document;
Step S203: use above-mentioned HTTP resource connecting object and be connected by the WSDL document of http protocol issue with Web Service.
Need to prove that after the WSDL document was connected, if connect unusually, then explanation did not connect the WSDL document, and then judged that current Web Service service is unavailable, if connection procedure does not occur then this locality is read and be cached to the WSDL document unusually.
When Web Service passed through HTTPS protocol issuance WSDL document, the flow chart that the application resource connecting object that the embodiment of the present application provides is connected with the WSDL document of Web Service issue comprised as shown in Figure 3:
Step S301: obtain the address of Web Service by the WSDL document of HTTPS protocol issuance;
Step S302: the HTTPS resource connecting object of creating above-mentioned WSDL address of document;
Step S303: use above-mentioned HTTP S resource connecting object and be connected by the WSDL document of HTTPS protocol issuance with Web Service.
Above step be need to prove: the HTTPS resource connecting object of creating the WSDL address of document, before this HTTPS resource connecting object is operated, first must (Secure Socket Layer SSL be a kind of security protocol that safety and data integrity are provided for network service to SSL.SSL in transport layer network is connected encrypt) context environmental, otherwise, can't use HTTPS protocol resource connecting object to be connected with the WSDL document, after the SSL context environmental carried out initialization, can use HTTPS protocol resource connecting object to be connected with the WSDL document, unusual if connection procedure occurs, then explanation does not connect the WSDL document, and then judge that current Web Service service is unavailable, if connection procedure does not occur then this locality is read and be cached to the WSDL document unusually.
By above argumentation as can be known, when can the WSDL document on connecting is read, and buffer memory being to home server when the WSDL document is connected;
Use the API of JAXP (Java API for XML Processing) to search { " address " } element from the WSDL document, the value of this element is created the resource connecting object of this address for the address of Web Service issue; The published method of above-mentioned Web Service address has two kinds, and a kind of Web of being Service issues by http protocol, and another kind is that Web Service is by the HTTPS protocol issuance;
When address that the value of above-mentioned element is Web Service by the HTTP issue, the flow chart that the application resource connecting object that the embodiment of the present application provides is connected with Web Service comprises as shown in Figure 4:
Step S401: search the Web Service address of service of the Web Service of appointment in the WSDL document by the http protocol issue;
Step S402: the HTTP resource connecting object of creating above-mentioned address of service;
Step S403: the HTTP resource connecting object of using above-mentioned establishment is connected with Web Service.
When address that the value of above-mentioned element is Web Service by the HTTPS issue, the flow chart that the application resource connecting object that the embodiment of the present application provides is connected with Web Service comprises as shown in Figure 5:
Step S501: search the Web Service address of service of the Web Service of appointment in the WSDL document by the HTTPS protocol issuance;
Step S502: the HTTPS resource connecting object of creating above-mentioned address of service;
Step S503: use above-mentioned HTTP S resource connecting object and be connected with Web Service.
Need be to what above step described:
Above step be need to prove: the HTTPS resource connecting object of creating Web Service address, before this HTTPS resource connecting object is operated, first must be to the SSL context environmental, otherwise, can't use HTTPS protocol resource connecting object to be connected with the WSDL document, after the SSL context environmental carried out initialization, can use HTTPS protocol resource connecting object to be connected with the WSDL document.
Tracking detection to Web Servcie availability is the process of a poll, if the OSGi environmental applications has dependence to a Web Service, then will follow the tracks of detection to this Web Service availability at set intervals, when the result of this detection of a Web Service is unavailable, and but the detection of last time is the time spent, the user Web Service of notification service now unavailable.
One detailed structure schematic diagram of a kind of Web Service availability tracing and detecting apparatus that present application example provides comprises as shown in Figure 6: first address acquisition unit 601, the first resource connecting object creating unit 602, first linkage unit 603, second address acquisition unit 604, the second resource connecting object creating unit 605 and second linkage unit 606;
Wherein: first address acquisition unit 601 is used to obtain the address of WSDL (Web Services Description Language is that a kind of being used for described Web service and the XML language of how to communicate by letter with the Web service is described) document of Web Service issue;
The first resource connecting object creating unit 602 is used for the address of the document that obtains according to first address acquisition unit 601, creates the resource connecting object of described address of document;
First linkage unit 603 is used to use first resource and connects the resource connecting object that creating unit 602 creates and be connected with the WSDL document of Web Service issue, if connect unusual, then Web Service serve unavailable, otherwise, obtain described WSDL document;
Second address acquisition unit 604 is used for searching the Web Service address of service of the WSDL document appointment that first linkage unit 603 obtains;
The second resource connecting object creating unit 605 is used for creating according to the address of service that second address acquisition unit 604 is searched the resource connecting object of described address of service;
Second linkage unit 606 is used to use the resource connecting object that the second resource connecting object creating unit 605 creates and is connected with Web Service, if connect unusually, then Web Service service is unavailable, otherwise Web Service serves available.
The another detailed structure schematic diagram of a kind of Web Service availability tracing and detecting apparatus of providing of application embodiment as shown in Figure 7, the first resource connecting object creating unit 602 comprises: a HTTP resource object creates assembly 607 and a HTTPS resource object is created assembly 608;
Wherein: a HTTP resource object is created assembly 607 and is used to create the HTTP resource connecting object of Web Service by the address of the WSDL document of http protocol issue;
The one HTTPS resource object is created assembly 608 and is used to create the HTTPS resource connecting object of Web Service by the address of the WSDL document of HTTPS protocol issuance.
The another detailed structure schematic diagram of a kind of Web Service availability tracing and detecting apparatus that the embodiment of the present application provides as shown in Figure 8, the second resource connecting object creating unit 605 comprises: the 2nd HTTP resource object creates assembly 609 and the 2nd HTTPS resource object is created assembly 610;
The 2nd HTTP resource object is created assembly 609 and is used to create the HTTP resource connecting object of Web Service by the address of service of http protocol issue;
The 2nd HTTPS resource object is created assembly 610 and is used to create the HTTPS resource connecting object of Web Service by the address of service of HTTPS protocol issuance.
The structural representation of a kind of Web Service availability tracking detection system that application embodiment provides comprises: client 701, a kind of Web Service availability tracing and detecting apparatus 702 and application end 703 as shown in Figure 9;
Wherein: but client 701 is used to the client that operating platform is provided;
Web Service availability tracing and detecting apparatus 702 is used for according to user instruction the availability of Web Service being followed the tracks of testing process and controls;
Application end 703 is used for that Web Service availability is followed the tracks of testing process and specializes implementation and operation.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and identical similar part is mutually referring to getting final product between each embodiment, and each embodiment stresses all is difference with other embodiment.The above only is the application's a embodiment; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the application's protection range.