This application is based on and claims the benefit of priority from United Kingdom (GB) Patent Application 1300415.5, filed on Jan. 10, 2013, and herein incorporated by reference in its entirety.
This invention relates to computer software applications, and more particularly web-based computer software applications known as web services.
Web services are web-based computer software applications which interact with other applications, such as other web services or software applications. Web services may be made publicly available or may be deployed in private environments, such as within a private organisation to enable divisions and/or subsidiaries to exchange data.
Web services are becoming increasingly more centralized in the design. The centrality of web services has led to intensive standardization work related to the documentation of web services and the discovery of web services according to metadata they publish;
Despite such advances, a developer of a software application is still expected to invest considerable time into the integration of web services into the software application. Currently, if a developer wishes to integrate a web service into a software application, this has to be done using ‘tight coupling’, wherein the developer commits to the use of a specific web service and explicitly references that particular web service in the program code of the software application. This has the following drawbacks or limitations:
Web services available at the time of developing the program code may no longer be available at the time of executing the code. It may therefore no longer be possible to use a software application that is tightly coupled to a non-existing web service. This even holds for a case when the web service is available but resides at a different location (e.g. on a different URL).
New web services may become available which provide the same or improved functionality compared to a web service that is tightly coupled to a software application. Execution of the software application may therefore invoke an out-of-date or superseded web service. A great deal of the time and effort can be required to manually search for an appropriate web service when developing the program code of a software application. For example, different repositories (or versions of the same repository) expose different interfaces for searching for a web service, which makes the searching process tedious.
A method, system, and/or computer program product invokes a web service in a software application. A software application comprises a machine readable description of a functionality to be supported by a web service to be invoked, and a machine readable description of an execution instruction for the web service to be invoked. One or more processors determine/identify a web service that supports the functionality to be supported and the execution instruction for the web service to be invoked.
Preferred embodiments of the present invention will now be described, by way of example only, with reference to the following drawings in which:
Referring to
The method starts in step 100 and proceeds to step 105 in which a user provides a program code containing a machine readable description of functionality required to be supported by a web service.
Next, in step 110, the user provides program code containing a machine readable description of a web service execution instruction. This web service execution instruction is a statement representing an instruction to execute or invoke a web service using one or more parameter values that are detailed in the statement.
Although the above steps 105 and 110 have been detailed above as being undertaken separately, it is to be understood that these steps 105 and 110 may alternatively be completed simultaneously (i.e. at once) by a user providing the program code of a software application that contains a machine readable description of both a required functionality and a web service execution instruction. In other words, the provision of a software application having the appropriate machine readable statements may complete both steps 105 and 110.
It will be understood that, as a result of completing steps 105 and 110, the features of a web service that are desired by the creator of the machine readable descriptions have been identified.
Next, in step 115, a web service is identified that will support the required functionality and execution instruction. In this example, this is done by firstly searching a database of web services to identify web services that provide the required functionality. For each the web services identified as providing the required functionality, information about supported execution instructions are then retrieved from the database for comparison with the execution instruction provided in step 110. If the comparison determines that an identified web service does not support the execution instruction, the web service is disregarded. Conversely, if the comparison determines that an identified web service does support the execution instruction, the web service is determined to meet the necessary requirements.
If only one web service is determined to meet the necessary requirements, that web service is selected for use. However, if more than one web service is determined to meet the necessary requirements, one of the web services is selected for use according to one or predetermined preferences which take in account properties such as: age of the web service; software version of the web service; cost of the web service; proprietor/owner of the web service; processing requirements of the web service; or operating system requirements of the web service.
The web service selected for use is then executed in accordance with the execution instruction in step 120. It will be understood that, as a result of step 115, the executed web service will provide the required functionality. Despite this, the web service may have been unknown or even not in existence when the program code was created.
The method then ends in step 125.
Turning now to
Firstly, in step 200, the machine readable descriptions (otherwise referred to as statements) are parsed to identify the required functionality and web service execution instruction(s). By way of example, below there is detailed a simplified sample of exemplary machine readable descriptions placed in the program code of a software application by a developer (where the programming language is similar to SQL).
The functionality expressed in the example above is that of finding a restaurant up to one kilometer away from a user's current location. Here, the first Select statement requires that a web service's description contains one (or more) of the strings “location”, “locator” and “finder”. The second Select statement traverses the operations of a matching web service, and requires that an operation's name contains both “business” and (at least) one of “find” or “locate”. Finally, the last line represents an invocation (i.e. an execution instruction) of a matching operation, including the arguments to be used
Next, in step 205, the identified requirements are analysed in order to determine search parameters or queries. Here, this step employs heuristic reasoning, such as identifying not only the keywords specified by the developer (such as “location”, “locator” and “finder” in the example above), but also using synonyms of these keywords. This may allow flexibility in the discovery of web services by relaxing the requirement for exact matching of a descriptor (which may otherwise be restrictive). The step also uses use context information. For example, the domain to which the software application belongs is detected use it as an additional parameter for determining requirements of a web service.
Using the search parameters determined in step 205, the method then undertakes searching of available web services in step 210. Here, a web service searching program is used in conjunction with the determined search parameters so as to identify web services that match the search parameters.
The identified web services (i.e. the search results) are then analysed in order to select a single web service in step 215. Here, many considerations may be accounted for when determining which web service to select so as to ensure an optimal match for the software application's requirements. Such considerations employ the following concepts:
Prioritize web services from a certain domain over web services belonging to other domains. For example, if a web service belongs to the domain of the software application, it is preferred to use the web service over another web service that belongs to a different domain;
Web services may impose financial charges for use, and so it may be preferable to select an appropriate web service that minimizes such financial cost;
Web service selection may take historical information into account. For example, preference may be given to web services that have been used before and/or caused fewer failures to a software application. Thus, a scoring system may be employed which gives preference to web services by scoring higher as a result of their frequency of their use or some usage measure;
It may be preferable to simply select a web service arbitrarily or at random; and
Web service selection may be based on minimizing the number of web services used by the software application. For example, a compiler may select a web service that has already been used or selected by another piece of code of the software application. This approach may help to minimize the costs if the web services impose financial charges for their use.
It will be understood that various considerations may be made when selecting a web service to use from a plurality of available web services. The optimal selection may therefore depend on the considerations taken into account and it is quite possible that different software applications will need to employ different selection criteria in step 215.
Turning back to the exemplary code given above (in relation to step 200), an instance of this example discovers that a web service represented by blocator, and specifically, the FindBusinesses operation, are compatible with the requirements specified by the exemplary code.
After having selected a web service in step 215, the method continues to step 220 in which program code for the software application is synthesized so as to enable execution of the code and subsequent invocation of the web service. Here, a compiler adds appropriate dependencies (e.g., a web reference in the case of Java or .NET), such that the web service (eg. blocator) proxy can be resolved (by binding the code with the URL where the web service is located (e.g. with the URL: www.locationexplorer.com/find/BusinessLocator.asmx?wsdl). For the example detailed above, the compiler would translate the exemplary code into the following synthesized code:
Referring now to
The input 310 interface is adapted to receive inputs and/or instructions from user, and the output interface 315 is adapted to provide information (such as outputs of a software application, for example) from the processing unit 305 to the user.
The data storage unit is adapted to store one or more descriptions of available web services. In other words, the data storage unit 320 is adapted to store a database of available web services. Here, the data storage unit 320 is also adapted to store statistical information about the web services, such as data regarding web service usage, the stability of web services over time, and web service performance information.
The processing unit 305 is adapted to execute a computer program which, when executed, causes the system to implement the steps of a method according to an embodiment, for example the steps as shown in
The processing unit 305 is adapted to receive, via the input interface 310, the program code of a software application, the program code containing a machine readable description of required web service functionality and a web service execution instruction. Based on the machine readable descriptions provided in the program code, the processing unit 305 determines the features of a web service that are desired by the creator of the program code and searches information (regarding available web service) stored in the data storage unit 320 to identify web services that support the required functionality and execution instruction.
If only one web service is determined to meet the necessary requirements, that web service is selected for use by the processor 305. However, if more than one web service is determined to meet the necessary requirements, one of the web services is selected for use according to one or more predetermined preferences. Here, the processor 305 is also adapted to receive, via the input interface 310, a user indication of such preferences. Thus, using such user-supplied information, the processor 305 determines which web service to use.
The processor 305 then synthesizes program code for the software application so as to enable execution of the code and subsequent invocation of the selected web service. Finally, the processor 305 executes the software application (included the synthesized code) and thus invokes the selected web service as part of running the software application. The result(s)/output(s) of the executed software application are provided to the user via the output interface 315. Thus, the processor 305 is adapted to identify and invoke a web service within a software application, even though the software application was not tightly coupled to a particular web service. This is done at run-time of the software application, and is based on a loose identification of web service requirements provided by the program code author at the time of coding the software application.
It is also noted that in this embodiment, the processor 305 injects a profiling code into the synthesized program code that is adapted to performance information about the web service when it is used. Such performance information is automatically provided to the processor (via the input interface 310) and subsequently stored in the data storage unit 320 for future use by the processor 305 in determining which web service to select.
Referring now to
The portable device 405 comprises a software application comprising program code containing a machine readable description of required web service functionality and a web service execution instruction. The portable device 405 is adapted to communicate the program code to the server 410 via the communication link 415.
The server comprises a central processing unit (CPU) 420 and a data store 425 which stores a database of web services.
The central processing unit 420 of the server 410 is adapted to analyse received program code in conjunction with the database of web services to identify a web service to employ. The central processing unit 420 then changes the program code so as to replace the machine readable description (provided in the program code) with synthesized program code (contain an execution instruction) for invoking the identified web service. The modified program code is then provided to the portable device 405 (via the communication link 415) for execution. Execution of the modified program code than causes the identified web service to be invoked by the software application.
It will be understood that the proposed embodiments implement a concept for reducing coupling to specific web services within software applications. Rather than relying on the specification of a particular web service within the program code of software application, embodiments may analyse machine readable descriptions of web service requirements in order to identify a web service that meets the described requirements. Program code for invoking the identified web service may then be incorporated into the software application so that it invokes the identified web service when run. It will be understood that this means the author of the program code need not know which web service to use at the time of creating the program code, and determination of the web service to use can be delayed until a later time (when the software application is executed, for example).
Embodiments may thus provide for run-time resolution of a required web service. In other words, the time of executing a software application, the description of the web service requirements contained in the program code of the software application may be utilized to search for a web service in place of the reference to an unspecified service created a compile time of the application. This may thus provide a pseudo auto-upgrade capability for the software application by ensuring the latest and most appropriate web service is invoked by the software application every time it is executed.
Embodiments may consult preconfigured online registries and perform a query using either the API specified by the UDDI/WSRR or using WS-Discovery protocol to work with the discovery proxy. When web services are found, embodiment may choose the most appropriate web service according to a predefined selection policy and create a proxy for the web service. If no web services are found then it is possible to use a default alternative.
Embodiments may be captured in a computer program product for execution on the processor of a computer, e.g. a personal computer or a network server, where the computer program product, if executed on the computer, causes the computer to implement the steps of a method according to an embodiment, e.g. the steps as shown in
In an embodiment, the computer program product is stored on a computer-readable medium. Any suitable computer-readable medium, e.g. a CD-ROM, DVD, USB stick, memory card, network-area storage device, internet-accessible data repository, and so on, may be considered.
Thus, presented herein is a novel method, system, and/or computer program product for invoking a web service from within a software application. Embodiments provide for the expression of a web service in the program code of a software application based on its required functionality. Such an approach enables the discovery and integration of a web service to be offloaded from a developer to a program compiler or execution system. Thus, a developer need not commit to a particular web service, but instead only specify one or more requirements of a web service. A compiler or run-time system may then be used to analyse the expression of the web service requirements and find a web service that meets the requirements.
Embodiments may thus provide a method or system for permitting a user to simply specify web service requirements in the program code, rather than defining a specific web service descriptor. This provides the freedom to use the best possible web service available at the time of executing the software application, thereby avoiding the need to use a web service that is out-of-date, non-ideal, or no longer available.
According to an aspect of the invention there is provided a method of invoking a web service in a software application, the method comprising: providing a software application having a machine readable description of a functionality to be supported by a web service to be invoked and a machine readable description of an execution instruction for web service to be invoked; and determining a web service that supports the function to be supported and the execution instruction.
In an embodiment, the step of determining a web service may comprise: analysing the machine readable description of a functionality to be supported so at to determine one or more search parameters; and using the determined one or more search parameters in conjunction with a web service search application.
In an embodiment, the step of analysing the machine readable description of a function to be supported may comprise employing heuristic reasoning to determine on or more alternative descriptions of the functionality to be supported. Furthermore, the web service search application may comprise a web service.
In an embodiment, the step of determining a web service may be undertaken upon executing the software application.
In an embodiment, the step of determining a web service may comprise: if more a plurality of web services are identified as supporting the function to be supported and the execution instruction, selecting one of the plurality of identified web services in accordance with predetermined selection criteria. Furthermore, the predetermined selection criteria take in account at least one of: age of an identified web service; the software version of an identified web service; a cost of an identified web service; the domain of a identified web service; the processing requirements of an identified web service; and historical use of an identified web service.
In an embodiment, the method may further comprise the steps of: generating program code for instructing the execution of the identified web service, and editing the software application to include the generated program code.
In an embodiment, the execution instruction may comprise one or more parameter values to be used by the web service; and wherein the method further comprises the step of executing the identified web service in accordance with the web service execution instruction.
According to another aspect of the invention, there is provided a computer program product for invoking a web service in a software application, wherein the computer program product comprises a computer-readable storage medium having computer-readable program code embodied therewith, the computer-readable program code configured to perform all of the steps of a method according to an embodiment.
According to yet another aspect of the invention, there is provided a computer system adapted to generate a tailored schema description of a web service from a predefined schema description of the web service, the system comprising: a computer program product according to an embodiment; and one or more processors adapted to perform all of the steps of a method according to an embodiment.
Various modifications will be apparent to those skilled in the art. For example, the exemplary machine-readable description detailed in relation to the embodiment of
Other variations to the disclosed embodiments can be understood and effected by those skilled in the art in practicing the claimed invention, from a study of the drawings, the disclosure, and the appended claims. In the claims, the word “comprising” does not exclude other elements or steps, and the indefinite article “a” or “an” does not exclude a plurality. A single processor or other unit may fulfil the functions of several items recited in the claims. The mere fact that certain measures are recited in mutually different dependent claims does not indicate that a combination of these measured cannot be used to advantage. A computer program may be stored/distributed on a suitable medium, such as an optical storage medium or a solid-state medium supplied together with or as part of other hardware, but may also be distributed in other forms, such as via the Internet or other wired or wireless telecommunication systems. Any reference signs in the claims should not be construed as limiting the scope.
Number | Date | Country | Kind |
---|---|---|---|
1300415.5 | Jan 2013 | GB | national |