【 abstract 】

In the first half of 2011, I worked in Shanghai ICSS Co., LTD., where I participated in the development of HR system as the project leader. Before the development of the system, the company has also adopted such systems as leave process, salary management and recruitment in the information construction. Although they are relatively mature, they are independent of each other and business data cannot be shared. In addition, the use of HR system in different branches of the company is also completely different. Some branches still use manual management of the business process which should be systematic information due to various reasons. The company is based on software outsourcing business, so the position of human resource management system in the company’s information construction is very important. The HR system developed this time will integrate the existing business system and be implemented throughout the company to solve the problem of inefficiency caused by information island. For future expansion needs, ensure the maximum scalability in business and space. Therefore, after discussion, decided to use REST Web services to achieve the system application layer. This article will describe the use and understanding of REST services in the HR system development process.

[text]

The HR management system of Shanghai Sinosoft is designed based on B/S three-tier architecture.

As the project leader, I participated in the whole process from system requirements analysis to test and deployment, reporting directly to the DIRECTOR of IT Department. Responsible for communicating requirements, establishing project team, determining system architecture style and technical implementation solution. The scheduled development cycle is 120 days, and there will be a two-month trial run period after the system deployment. The number of team members will vary from 5-10. Due to the shortage of project development resources (such as time), the complex business logic of the HR system of the company, the interweaving of old system improvement and new requirements, the project team is not familiar with the business, so it is difficult to estimate the time of porting all the business to the new system at the beginning. Therefore, in the development model selection, adopt spiral incremental development. First of all, it is not necessary to pursue a large and complete system. On the basis of developing the basic framework of the system, the most urgent business to be improved should be transplanted first. After communication and research with the leader and HR department, I submitted a list of functions to be implemented by the system. The functions marked P1 have the highest priority and must be implemented. The functions marked as P2, P3, and P4 have lower priorities. You can tailor them based on resource requirements when necessary.

As for the choice of development technology, most of the company’s developers are familiar with one or more Microsoft development technologies because the company’s business is mainly outsourced by Microsoft. As Microsoft’s corporate partners, they can obtain software development and management tools at a low cost and easily obtain technical support. So decided to use the system of Microsoft technology: the presentation layer based on ASP.NET 4.0; The intermediate business layer adopts REST service implementation, based on WCF(Windows Communication Foundation) 4.0; Data access layer based on Microsoft ORM component -AEF(ADO.Net Entity Framework) 4.0. In the selection of components, as far as possible to reduce the development workload, improve efficiency, and strive to avoid the main focus on general technical details, but on the research and implementation of business logic.

The system is deployed on three servers: Two Web servers, Windows Server 2008 and IIS 7.5, respectively running the system website and REST service. One database Server Windows Server 2008 + SQL Server 2008. After a trial run, it was put into use in July. At present, the system is in good condition. After operation evaluation, all the necessary functions have been realized, and the quality of performance and security have reached the original design requirements. At present, the system is under secondary development by the follow-up project team according to the business needs.

Using REST services to implement the business logic layer of the system fully conforms to the two factors considered in project development: simplicity and flexibility. Traditional Internet Web services are generally based on SOAP protocol, although currently constructed SOAP request XML. NET Framework has been implemented better encapsulation, but not inconvenience. Net language calls, such as client-side pages, are heavily Ajax based, and it is difficult to construct Soap requests using JavaScript. It is inconvenient to have to write a separate test program in order to debug and test the service before the Web page that calls it is developed.

By contrast, REST services are remarkably flexible. It can be called either by the server-side object-oriented language or directly by the client-side scripting language. It’s also easy to test with a browser and the Fiddler tool. In our project, we did not treat the REST service simply as a response to a list of addresses, but based on the HTTP protocol, we were able to make the most of the semantic features of the HTTP protocol. For example, the operations of adding, deleting, modifying and querying data correspond to different Http methods (Put, Delete, Update, and Get). The user can use the same access service Endpoint to obtain the data result in different forms, such as JSON (for Ajax) or XML(for backend), by setting different accept-types in the request header as needed.

Better performance and caching support — There is obviously less overhead to request Rest services because there is no need to construct Soap messages. Rest-like Web services can take advantage of caching control headers to reduce bandwidth requirements, so REST can improve response times and improve the user experience. Scalability and statelessness – each request is independent. Once invoked, the server does not retain any session, making it more responsive. The scalability of the server is improved by reducing the maintenance of the communication status after the event.

When developing REST services for a system, there are also some problems:

I. Security scheme. It’s not that REST services are insecure and don’t have built-in security support, but almost all HTTP supported security modes and frameworks can be used with REST services. The real potential risk lies in the flexible use of REST, which can be called by both the server side and the client side. Therefore, it is necessary to distinguish the user access permission from the system access permission at the beginning, and distinguish the Web page permission from the REST service permission, but sometimes it is often confused in the development. Therefore, strengthen the documentation and evaluation in the design phase.

Ii. Service interface standardization. REST services are accessed based on URI addresses and are very semantic, with each operation of the service interface based on a URI template. In actual business, operations with similar functions are made into multiple overloads. With the increase of overloads, how to agree and how to extend URI templates becomes a normative problem. In the beginning, this was not taken seriously enough, and the service was developed by many people, so that some of the service operation semantics became confused and affected understanding and proper use. Later, additional time and resources were spent on standardizing the format of the operation Uri. This is due to the lack of clear standards in the industry, and more importantly, the design time should fully consider how to extend the semantics of URI templates if they need to be overloaded in the future. Other specification issues, such as how Http methods are defined, should also be considered, such as operations that include more than one type of data operation.

3. Limitations of WCF REST. The DEVELOPMENT of WCF from 3.0 to 4.0 is relatively mature. WCF’s REST component, on the other hand, is a completely new technology, WCF as. NET platform Web Service replacement, whether in development or management, is extremely flexible. The flexibility of WCF REST is reflected in the development and use. In the case of management and maintenance, WCF REST service interface operation does not provide the same flexible configuration function as WCF. Elements such as URI templates must be set in the code.

Overall, while REST services are still evolving, there is still a lot of room for improvement in experience and technology. There is no doubt, however, that WEB applications based on REST services have many advantages and will have a much brighter future in the WEB system. (2259 words)