Invention content
To solve the above problems, the present invention provides a kind of WEB service system based on XML, including WEB client side, WEB
Server completes data interaction between WEB client side and WEB server by XML file, and the WEB server includes XML
Processing module, data processing module, data source, data-interface, memory module, wherein memory module is configured for memory page
File and pre-defined XML file template;
XML processing modules, will for the page script of loading page configuration file, the XML request of reception WEB client side
XML request resolves to script request and request of data, completes script request response, and request of data is sent to data processing mould
Block, the data for receiving data processing module feedback, adaptation XML templates complete XML file encapsulation, send packaged XML file
To WEB client side;
Data processing module is used for the data item of loading page configuration file, according to the phase in request of data linked database
Data are closed, and related data is fed back into XML processing modules;
Data source is to store local or the far-end server of data, gives WEB client side and provides data support;
Data-interface is used for the data of operating database;
Page configuration file includes page script file and page data configuration file, and page script file is for constructing
WEB page includes page index, holding equipment model, data item information in page data configuration file;Each WEB page institute
All kinds of keywords being related to are presented in the form of page configuration file.
Further, the data item of the data processing module loading page configuration file establishes data directory tree, data
Data item in index tree is associated with corresponding data-interface.
Further, the data-interface is mib nodes or api interface.
Further, data source is using mib nodes or api interfaces or database.
Further, the data item of page data configuration file includes index, type, oid and/or the data of each data
Library indexes.
Further, all kinds of keywords involved by WEB page are presented in the form of configuration file.
Further, it is cached after XML processing modules loading page script file, utilizes the page script sum number of caching
XML file encapsulation is carried out according to the data of processing module feedback.
The working method of the above-mentioned WEB service system based on XML, comprises the following steps:Step 1:WEB client side is sent
XML request is to WEB server;
Step 2:The XML processing modules of WEB server carry out XML request parsing, and XML request is resolved to script request
And request of data;
Step 3:Required page script is loaded into caching by XML processing modules according to page configuration file, and sends number
Data processing module is arrived according to request processing;
Step 4:Data processing module extracts the page data of page configuration file, generates data directory tree;
Step 6:Location data node is mapped to associated data interface, and is associated with data source;
Step 7:Data source is by data-interface by data feedback to XML processing modules;
Step 8:XML processing modules carry out XML template adaptations according to the data of feedback;
Step 9:XML templates are filled using the page script of caching and the data of feedback, complete XML encapsulation;
Step 10:Packaged XML file is transferred to WEB client side, completes XML request response.
Beneficial effects of the present invention are:
Flow is uniformly processed by the way that XML is made a general module in the present invention.Mode using XML templates meets
The XML request of various patterns.The Data Node for isolating each page makes a database, provides the general of operation data
Interface.Institute's data in need are loaded into WEB server additionally by page configuration file, to promote the place of WEB server
Rationality energy.The WEB page of planning, involved all kinds of keywords are presented in the form of configuration file, and the configuration file is again
The data needed for WEB server are derived, constructs database is carried out.The development of WEB client side and server since then, with
One common page configuration file does bridge, meets the synchronization of information, greatly reduces mutual constraint, can realize parallel
Development mode.
Specific implementation mode:
In the development mode of common WEB server, each page needs individually processing, flips the signal of its processing mode such as
Shown in Fig. 2.The keyword definition and content of request data need in advance and unification is reached in WEB client side exploitation.Server is developed
It is limited to that WEB client side is more in the process, and along with the revision of WEB page, the realization of WEB server, which can be also inconjunction with, repaiies
It orders, there is also certain hidden danger for the process performance of WEB server.
To solve the above-mentioned problems, the present invention changes conventional thought, in WEB server process flow and development mode
It improves, it is proposed that a kind of new WEB service system based on XML itself and its working method.It is introduced separately below.
WEB service system based on XML includes WEB client side, WEB server, between WEB client side and WEB server
Data interaction is completed by XML file.The present invention is when developing WEB server, according to the feature of various types XML, definition
Different XML templates, flow is uniformly processed.Meet the XML request of various patterns using the mode of XML templates.Each XML moulds
Plate only needs to carry out corresponding data and script filling.
In the present invention, the process flow of WEB server all has unified flow, and flow is as shown in Figure 3.Process flow
It is completed by following XML processing modules and data processing module, therefore in WEB server development process, groundwork collection
In in page configuration file, once configuration file housekeeping finishes, you can generate corresponding data item.It therefore can be largely
The upper resource input for reducing exploitation, is suitble to development mode rapidly and efficiently.
For convenience of the present invention is understood, first page configuration file is illustrated below.It is all kinds of involved by each WEB page
Keyword is presented in the form of page configuration file.The page configuration file includes:Page script file and page data
Configuration file.
For constructing WEB page, content for script is directly encapsulated into WED servers and responds to WEB the page script file
In the XML file of client.Page script only needs that caching is taken out and be stored in from page configuration file, raising that can be larger
The treatment effeciency of server.
Include the information, wherein data item packet such as page index, holding equipment model, data item in page data configuration file
Include index, oid (object identifier), type, the data source index of each data.
Oid and data source index can be used as getting data, adapt to diversified data processing.Oid is needed
Snmp servers support, the oid uniquely indicated by data is processed.The data source index directly specified parameter of basis,
Corresponding business datum node is navigated to, reuses api interfaces to process.
Page data configuration file is schematically as follows:
File content illustrates, such as table 1.
Table 1
WEB server is introduced below.
The WEB server further includes XML processing modules, at data other than necessary operation program and related hardware
Manage module, data source, data-interface, memory module.
Memory module is used for memory page configuration file and XML file template.
The effect of XML processing modules is as follows:
1. in the page script to caching for loading required page configuration file.
2. the XML request for receiving WEB client side decomposites corresponding data in conjunction with the feature of XML language, by XML request
Script request and request of data are resolved to, completes script request response, and request of data is sent to data processing module.
3. receiving the data of data processing module feedback, it is adapted to XML templates.
The present invention defines different XML templates, is filled out further according to the type of actual request according to the feature of various types XML
Corresponding template data is filled, to adapt to various types XML request, achievees the purpose that be uniformly processed.
4. by the XML data of feedback, page script, as a result, and the information such as data encoding, language, to be assembled into one
Complete XML file.
5. sending packaged XML file to WEB client side.
Data processing module effect is as follows:
1. being extracted all page datas according to page configuration file, required data item is pre-loaded
Into data directory tree, so as to rapidly locating node.
2. according to the configuration parameter association of page data to the data source of corresponding business module, and related data is fed back to
XML processing modules.
Data source is to store local or the far-end server of data, gives clients providing data support.Data source institute
Network environment and there may be differences for position, this just needs to access data using different modes.The wherein interface sides api
Formula is suitable for directly accessing local data source, and mib and database are suitable for accessing specified local or far-end server
Data.
Data-interface is used for the data of operating database.Mib nodes or business api interfaces etc. may be used in data-interface
Mode, or can be adopted according to the actual needs of embedded device.Data item in index tree needs to be associated with corresponding number
According to interface, to handle request of data.
The workflow of this system is illustrated with reference to Fig. 4.
Step 1:WEB client side sends XML request to WEB server;
Step 2:The XML processing modules of WEB server carry out XML request parsing, and XML request is resolved to script request
And request of data;
Step 3:Required page script is loaded into caching by XML processing modules according to page configuration file, and sends number
Data processing module is arrived according to request processing;
Step 4:Data processing module extracts the page data of page configuration file, generates data directory tree;
Step 6:Location data node is mapped to associated data interface, and is associated with data source;
Step 7:Data source is by data-interface by data feedback to XML processing modules;
Step 8:XML processing modules carry out XML template adaptations according to the data of feedback;
Step 9:XML templates are filled using the page script of caching and the data of feedback, complete XML encapsulation;
Step 10:Packaged XML file is transferred to WEB client side, completes XML request response.
Beneficial effects of the present invention are:
Flow is uniformly processed by the way that XML is made a general module in the present invention.Mode using XML templates meets
The XML request of various patterns.The Data Node for isolating each page makes a database, provides the general of operation data
Interface.Institute's data in need are loaded into WEB server additionally by page configuration file, to promote the place of WEB server
Rationality energy.The WEB page of planning, involved all kinds of keywords are presented in the form of configuration file, and the configuration file is again
The data needed for WEB server are derived, constructs database is carried out.The development of WEB client side and server since then, with
One common page configuration file does bridge, meets the synchronization of information, greatly reduces mutual constraint, can realize parallel
Development mode.