1. Field
The present subject matter relates to a web server apparatus for processing a request for use of an Internet printing protocol (IPP) service, a method for controlling the web server apparatus, and a program therefor.
2. Description of the Related Art
The number of systems for operating a plurality of web services on a single web server has been continuously increasing. For example, in a printer, web-based printing services such as a device setting and management service (hereinafter referred to as Remote User Interface (UI)), an IPP service, and web services on devices (WSD) are operated on a single web server.
In order to operate a plurality of web services on a single web server, a unique uniform resource locator (URL) needs to be allocated to each of the web services. This is because when the web server receives a request to use a web service operated on the web server, the web server needs to determine which web service the request should be transmitted to for execution, based on the URL information included in an HTTP header of the request data.
Accordingly, the web services and the URLs need to be associated with each other on a one-to-one basis. Thus, the system has conventionally been required to be constructed such that a unique URL is allocated to each of the web services to be provided in a device.
Moreover, Japanese Laid-Open Patent Application No. 2008-176789 discusses a technique for registering only the application path of the URL to reduce the loads on the web server.
According to an aspect of the present subject matter, a web server apparatus includes a reception unit configured to receive a registration request from a web service and receive a URL and an extension determination condition used to identify the web service, a registration unit configured to, if the same URL as the received URL is already registered in a web service management table, register in the web service management table a correspondence between the received URL and the received extension determination condition and a function for calling the web service in association with each other as information of the web service that has transmitted the registration request, after determining that the received extension determination condition is not the same as an extension determination condition registered in the web service management table, and a request unit configured to, if a request is received and if the same correspondence as a correspondence between a URL and an extension determination condition included in the request is registered in the web service management table, call a web service for processing the request by using a function registered in association with the correspondence.
Further features of the present subject matter will become apparent from the following description of exemplary embodiments with reference to the attached drawings.
There are cases where the same URL is desired to be used for a plurality of web services operated on a single web server. For example, an “http://Internet protocol (IP) address/” path for specifying an image forming apparatus, and a hypertext transfer protocol (HTTP) path including a single IP address for specifying a web service are defined to simplify a user input. If the user knows such a path, the user can use the service by using a route path (“/”). This allows the user to use the web service simply by remembering the IP address, thereby providing high usability. Thus, a single URL is used for different web services, so that a user does not need to remember the URL of each of the web services.
However, since such a technique provides one-to-many correspondence between the URL and the web services, the web server cannot identify which web service a request should be transmitted to in response to a received URL.
The present subject matter is directed to a web server apparatus that allows a web server to identify which web service to call according to a received HTTP request if a plurality of web services having the same URL operates on a single web server.
Various exemplary embodiments, features, and aspects of the subject matter will be described in detail below with reference to the drawings.
In a first exemplary embodiment of the present subject matter, a web server function will be described, which allows a web server to identify which web service should process a request even if a plurality of web services has the same URL.
In
The web server apparatus 100 includes a communication unit 130 for network communication, a web server 120 for providing a web server function, and web services 140, 150, 160, and 170. Each of the web services 140, 150, 160, and 170 provides a service by operating on the web server 120. Here, the “service” represents a function included in a web service such as the above-described Remote UI service and IPP service, and also a web distributed authoring and versioning (WebDAV) service. The web server 120 receives an HTTP request via HTTP communication, and allocates the request to the web service specified in the request, so that the web service provides the service thereof. Each of the web services 140, 150, 160, and 170 has a function equivalent to a common gateway interface (CGI) or a servlet, for example. Each of the web services 140, 150, 160, and 170 registers the web service determination condition (extension determination condition) in the web server 120. When the web server 120 receives a request corresponding to any of the extension determination conditions, the web server 120 allocates the request to the web server corresponding to the condition. This enables the web service to perform the processing specified in the HTTP request to provide the service thereof.
The web client apparatus 300 includes web service clients 320, 330, 340, and 350. The web service clients 320, 330, 340, and 350 include, for example, a web browser for displaying received hypertext markup language (HTML) data, a WebDAV client for storing/acquiring data in/from the storage of a web service, a WSD print for printing data using a print service provided by a web service, and an HTTP client. Each of the web service clients 320, 330, 340, and 350 has a function of communicating with a web service by using HTTP, requesting the web service to perform processing, receiving a result of the requested processing, and providing the received result to a user.
In order to request a web service to perform processing, each of the web service clients 320, 330, 340, and 350 transmits an HTTP request to the web server 120 by using a communication unit 310 of the web client apparatus 300. When receiving the request, the web server 120 analyzes the HTTP header part of the request, and determines whether the request corresponds to any of the extension determination conditions registered by the web services 140, 150, 160, and 170. If the web server 120 determines that the request corresponds to any of the registered extension determination conditions, the web server 120 executes a function for processing the corresponding web service. When the web server 120 executes the function for processing the web service, the web service performs the requested processing according to the HTTP operation or the HTTP body part of the received data as necessary, thereby providing the service.
The web server apparatus 100 includes a read only memory (ROM) 102 and a hard disk drive (HDD) 103 illustrated in
The CPU 101 comprehensively controls each unit connected to a system bus 104 by executing a program stored in the ROM 102 or the HDD 103. A random access memory (RAM) 111 functions as a main memory and a work area of the CPU 101. A control unit 105 of the web server apparatus 100 having the storage server function controls a printer 106 serving as a print engine or the HDD 103.
A software configuration of the first exemplary embodiment is realized by the CPU 101 of the web server apparatus 100 which executes a program stored in the ROM 102 or the HDD 103. A non-volatile random access memory (NVRAM) 107 stores various setting values for defining operations of the web server apparatus 100. A panel control unit 108 controls an operation panel 109 to display various information and receive an instruction from a user through the operation panel 109. A network interface (I/F) control unit 110 controls transmission and reception of data to and from the network 200.
The web client apparatus 300 also has the hardware configuration illustrated in
The web service management table 122 is structured as illustrated in
A request (HTTP header) receiving unit 123 has a function of receiving the HTTP header part of a request transmitted to the web server 120 via the network. A web service determination unit 124 has a function of analyzing the HTTP header information received by the request (HTTP header) receiving unit 123, and identifying an appropriate web service according to the corresponding extension determination condition registered in the web service management table 122.
A web service execution unit 125 executes the web service identified by the web service determination unit 124. The web service execution unit 125 has a function of enabling HTTP communication with the identified web service. This HTTP communication function enables, for example, receiving an HTTP body part and transmitting an HTTP response according an HTTP protocol.
If the web service 140 is disabled (DISABLED in step S100), web service information does not need to be registered in the web server 120. Thus, the processing is ended without registering the web service information in the web server 120. If the web service 140 is enabled (ENABLED in step S100), the processing proceeds to step S101. In step S101, the web service registration unit 141 checks the web service execution determination condition to be registered in the web server 120. More specifically, the web service registration unit 141 determines whether to register only URL information or an extension determination condition in addition to the URL information. The extension determination condition may be an attribute unique to the web service 140, or may be set for the web service 140 by an administrator.
If only the URL information is registered (YES in step S101), then in step S102, the web service registration unit 141 registers the URL information and the web service processing function. If there is an extension determination condition in addition to the URL information (NO in step S101), the processing proceeds to step S103. In step S103, the web service registration unit 141 registers the URL information, the corresponding extension determination condition, and the web service processing function in the web server 120.
Here, the above-described URL information to be registered in the web server 120 will be additionally described. Generally, URL indicates a format defined by a request for comments (RFC) 1738. However, the URL information to be registered in the web server 120 represents a protocol (HTTP/HTTPS), the TCP port number by which the service is provided, and URL path information, instead of the information defined by the RFC 1738.
Further, any information specified in an HTTP header can be used as an extension determination condition. For example, the extension determination condition may be HTTP operation, Content-Type or User-Agent of an HTTP header, or HTTP extension header information beginning with “x-” as an extension to an application, which is defined by RFC 822. If the web service 140 registers its extension determination condition in the web server 120, the web server 120 does not call the web service 140 by using the processing function for the web service 140 unless both the URL information and the extension determination condition are matched even if the URL information is matched. Alternatively, the determination may be made based on two or more extension determination conditions. For example, if it is determined that another web service having the same URL path also has the same HTTP operation, the determination is further made based on the Content-Type. Thus, the web service 140 can register an extension determination condition in the web server 120, in addition to the URL.
Next, web service registration processing in the web server 120 will be described.
The web service registration processing unit 121 is stored in any of the storage units, the RAM 111, the ROM 102, and the HDD 103, and is executed by the CPU 101. Here, the flow of processing performed by the web service registration processing unit 121 illustrated in
First,
In the web service management table 122 illustrated in
The flowchart illustrated in
In step S200, when receiving a web service registration request from the web service 140, the web service registration processing unit 121 checks the TCP port number of the URL information specified by the web service registration unit 141.
In step S201, the web service registration processing unit 121 determines whether there is a web service management table corresponding to the specified TCP port number in the web service management tables 122. If there is no web service management table corresponding to the specified TCP port number (NO in step S201), then in step S206, the web service registration processing unit 121 generates a new web service management table for the specified TCP port number. Subsequently, in step S207, the web service registration processing unit 121 registers the specified service name, URL path, and extension determination condition in the generated web service management table. Then, the processing is ended. If no extension determination condition is specified by the web service 140 in addition to the URL information, a field for an extension determination condition is blank and ignored. If a web service is registered with a blank field for an extension determination condition, at the time when the URL path is matched, the web service is identified as the web service to process the transmitted request. The configuration is such that even if web services are registered with a blank field for an extension determination condition and the extension determination condition included in the request does not match the registered extension determination condition, any of registered web services can be always executed.
Here, the IPP service 140 specifies the TCP port number 80. If the web service registration processing unit 121 determines that there is a web service management table corresponding to the TCP port number 80 in the web service management tables 122 (YES in step S201), the web service management table 122 illustrated in
If the same URL path is registered (YES in step 202), then in step S203, the web service registration processing unit 121 performs a comparison using the extension determination condition. In this example, since the HTTP operation as the extension determination condition is provided in the web server 120, the web service registration processing unit 121 compares the HTTP operation of the Remote UI service 150 with the HTTP operation to be registered by the IPP service 140. For the Remote UI service 150, the HTTP operation is not specified as illustrated in
Next, processing for checking the registration priority of web services and then actually registering the web service 140 in the web service management table 122 will be described. In step S205, the web service registration processing unit 121 compares the number of extension determination conditions of the web service 140 to be newly registered this time with the number of extension determination conditions of the registered web service 150 having the same URL path. This comparison is made because when the web service determination unit 124 searches for a web service corresponding to the extension determination condition of a request, the web service determination unit 124 checks the web services in the web service management table 122 in ascending order of registration number to determine whether there is a web service corresponding to the request. Therefore, a web service having a stricter condition needs to be registered with a smaller registration number in the web service management table 122 than a web service having a less strict condition. Otherwise, the web service having a less strict condition may be searched for first, since the number of extension determination conditions thereof is less than that of the web service having a stricter condition. This may cause the web service having a stricter condition to remain unsearched due to the larger number of extension determination conditions.
Based on the comparison, one extension determination condition is set for the IPP service 140, whereas no extension determination condition is set for the Remote UI service 150. In step S209, since the IPP service 140 needs to be given a higher search priority than the Remote UI service 150, the IPP service 140 is inserted and registered in the registration No. 1. As a result, the registration numbers of the Remote UI service 150 and the WebDAV service 170 are shifted by one from the registration numbers in the table illustrated in
Here, an example will be described where the web service management table 122 is as illustrated in
In such a state, it is assumed that the HTTP web service (IPP service) 140 has transmitted a registration request by specifying the TCP port number as “80”, the URL path as “/”, the HTTP operation as “POST”, and the Content-Type as “application/ipp”. In this case, in step S205 in the flowchart illustrated in
Lastly, processing executed by the web service determination unit 124 will be described with reference to
In step S300, when receiving a request to a web service, the request receiving unit 123 requests the web service determination unit 124 to determine the web service. The web service determination unit 124 acquires from the request receiving unit 123 the receiving TCP port number where the HTTP request has been received, and the HTTP header information of the received request. The web service determination unit 124 analyzes the HTTP header information.
In step S301, the web service determination unit 124 checks whether there is a web service management table corresponding to the receiving TCP port number in the web service management table 122. If there is no web service management table corresponding to the TCP port number (NO in step S301), the processing proceeds to step S307. In step S307, the web service determination unit 124 determines that the corresponding web service does not exist. On the other hand, if there is a web service management table corresponding to the receiving TCP port number (YES in step S301), the processing proceeds to step S302. In step S302, the web service determination unit 124 sets a service search starting position to the top of the registration numbers (i.e., the registration No. 1) in the detected web service management table.
In step S303, the web service determination unit 124 searches for any registered service having the same URL path as that of the received HTTP request, starting from the search starting position in the selected web service management table. If there is no registered service having the same URL path (NO in step S303), then in step S307, the web service determination unit 124 determines that there is no web service that can process the request. Subsequently, the processing is ended. If the web service determination unit 124 has detected a registered service having the same URL path (YES in step S303), the processing proceeds to step S304. In step S304, the web service determination unit 124 checks whether the extension determination condition of the detected web service matches the extension determination condition transmitted with the request. If these extension determination conditions do not match each other (NO in step S304), the processing proceeds to step S305. In step S305, the web service determination unit 124 sets a search starting position in the web service management table 122 to the location of the web service having a registration number that follows the registration number of the web service determined not to be matched this time. Then, the processing returns to step S303 and step S304, so that the web service determination unit 124 continues to search for the web service having the same URL path and the matched extension determination condition. If the web service determination unit 124 determines that the extension determination condition matches the transmitted extension condition (YES in step S304), then in step S306, the web service determination unit 124 determines that the web service corresponding to the request has been found.
Now, a specific example of processing by the web service determination unit 124 will be described with reference to the flowchart illustrated in
In order for a user to connect to the web service (the Remote UI service 150), the user inputs the URL information of the Remote UI service 150 in a URL input field of the web service client 350 (hereinafter referred to as a web browser). The URL information to be input is, for example, http://172.24.29.162/. This URL information may not necessarily be input in the input field of the web browser 350. The URL information may be input by selecting the information registered as a bookmark in the web browser 350. The information “172.24.29.162” indicates the IP address of the web server apparatus 100. A combination of “http://” and the IP address enables each of the web service clients 320, 330, 340, and 350 to access the web server 120. The web browser 350 identifies the web server 120 based on the input URL information, and transmits an HTTP request for acquiring HTML data, which is illustrated in
When receiving the HTTP header of the request data illustrated in
Further, another specific example will be described where a user is to connect to the IPP service 140. The IPP service 140 is the Internet Printing Protocol, and the versions 1.0, 1.1, 2.0, 2.1, and 2.2 are defined by the RFC. The IPP defines commands for checking the status or capability of a printer, issuing an instruction to print a specified document, and checking the job status. These commands are stored in the HTTP body part. In other words, the operation of the IPP cannot be identified with the HTTP header.
If the user uses the IPP service 140 to check printer capability information, the user needs to specify the URL of the IPP service 140 in the IPP client 340. The URL of the IPP service 140 can be directly specified by the user. The URL of the IPP service 140 can also be searched for via a network by using a service search technique such as a multicast domain name system (mDNS) and a service location protocol (SLP). Based on the search result, the URL of the IPP service 140 can be acquired.
When the user searches for and acquires the URL information of the IPP service 140 or directly inputs the URL in the IPP client 340, the user is connected to the specified URL. It is assumed here that the URL is, for example, http://172.24.29.162/. This URL is the same as that of the Remote UI service 150 described above. Registering the web service 140 in this state causes both the web service 140 and the Remote UI service 150 to be registered with the same URL. Then, the IPP client 340 transmits a request including HTTP header information and an HTTP body part illustrated in
When receiving the HTTP header of the request data illustrated in
The IPP request is defined by RFC 2910, and an instruction to the IPP service 140 is specified in the operation-id field. An instruction to the IPP service is, for example, a Print-Job request for performing a print operation, or a Get-Printer-Attributes request for acquiring printer attributes. “0x0002” specified in the operation-id field indicates the Print-Job request, whereas “0x000B” specified in the operation-id field indicates the Get-Printer-Attributes request.
When receiving the request data in the format illustrated in
When the IPP service 140 completes the processing specified by the IPP request data illustrated in
The IPP client 340 acquires a result of the request from the data stored in the HTTP body part of the received response, and ends the communication with the IPP service 140.
As described above, according to the first exemplary embodiment, even if a plurality of web services having the same URL operates on a single web server, the web server can identify which web service to call, based on a received HTTP request. Since the HTTP request may differ depending on each web service client that transmits the request, the web server can identify the web service from among the plurality of the web services having the same URL. Consequently, the user needs to remember only one URL. This allows a variety of web services to be executed while maintaining usability.
Another exemplary embodiment of the present subject matter will be described. The above-described exemplary embodiment of the present subject matter is realized by executing the processing, in which software (program) for implementing the functions of the above-described exemplary embodiment is supplied to a system or an apparatus through a network or various storage media, and the program is read out and executed by a computer (or a CPU or a micro-processing unit (MPU)) in the system or the apparatus.
Thus, even if a plurality of web services having the same URL operates on a single web server, the web server can identify which web service to call, based on a received HTTP request.
While the present subject matter has been described with reference to exemplary embodiments, it is to be understood that the subject matter is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.
This application claims the benefit of Japanese Patent Application No. 2013-013324 filed Jan. 28, 2013, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2013-013324 | Jan 2013 | JP | national |