Across the Web are many job sites that enable employers to post employment positions and job seekers to post resumes. Normally, the sites will let users either build a resume manually or post a text-based version of their existing resumes.
Because of the risk of document-based computer viruses, most websites do not let users post resumes as Word documents.
Before we get into the nitty-gritty of building the Jobs web service, let’s briefly examine the user interfaces for posting job opportunities and resumes, and consider the issues of database integration and access control.
The Jobs web service provides two methods that let a user post a resume. The first receives a string that contains the user’s resume in an XML format. As you have learned, XML is well suited for submitting data (such as a form’s field values) because XML is self-describing—meaning, the XML contents specify the field names and field values. Assume, for example, a user completes the Resume Builder form shown in Figure 16.1.
Figure 16.1: Building a resume manually by using the Resume Builder form
A client application can submit the data the user enters to a remote web service using XML entries similar to the following:
<Dataset> <Table> <Name>Joe Smith</Name> <Phone>555-1212</Phone> <Email>Joe@MyHahoo.com</Email> <Education>MBA from Harvard, 2002</Education> <Experience>Successful business negotiator</Experience> </Table> </Dataset>
The web service, in turn, can use the field descriptions to determine each value and then store the entries within a database.
As discussed, to prevent users from submitting document-based viruses, many websites require users to submit text-based versions of their resumes. Unfortunately, the text-based documents destroy any formatting the user has applied to the resume. As an alternative, a site can use a rich-text format (RTF) control similar to that shown in Figure 16.2 to submit the formatted resume.
Figure 16.2: Using a rich-text format (RTF) control to support formatted text
To send the RTF data to the web service, a program simply transfers binary data as discussed in Chapter 11, “Integrating Binary Data into .NET Web Services.”
The Jobs web service supports two methods that let an employer upload job postings. The first supports sites that let employers build a posting manually, using a form similar to that shown in Figure 16.3.
Figure 16.3: Building a job opportunity manually by using a form
After the employer submits the job opportunity, a program can group the entries using XML similar to the following:
<Dataset> <Table> <Title>Short-Order Cook</Title> <Salary>$25,000</Salary> <Hours>8AM to 5PM</Hours> <Experience>Must have fast-food knowledge</Experience> <Skills>Cooking and food preparation</Skills> <Contact>210-555-1212, ask for Jim</Contact> </Table> </Dataset>
The second method supports the submission of an RTF-based job description, which an employer might submit to the web service after collecting the data using a form’s RTF control as shown in Figure 16.4.
Figure 16.4: Using an RTF control to post a job opportunity
To manage the resumes posted by employees and the job descriptions posted by employers, a web service requires a database (likely several databases). For simplicity (to eliminate the need to spend pages describing databases you may not use in the future), the Jobs web service stores data on the server within files (using a flat-file directory structure).
The web service organizes the jobs and resumes using a directory structure similar to that shown in Figure 16.5. As you can see, the web service organizes job descriptions by company within the Jobs folder and resumes by category within the Resumes folder.
Figure 16.5: The Jobs web service organizes content using files.
Depending on your site’s purpose, you will likely need a way to control how users access the site. You would not, for example, want to allow just anyone to post job listings for a company. In Chapter 8, “Authenticating Users within .NET Services,” and in Chapter 9, “Securing Communication between a Web Service and a Client,” you learned how to use the secure sockets layer to encrypt the data programs and web services exchanged across the Net.
Before an employee or company can post or remove a job entry, the Jobs web service requires that the user provide a valid username and password. In Chapter 15, “Making Money with Web Services,” you learned ways to manage the users that can access a site.
Depending on the revenue model that you choose for the site, you might charge employees and employers a fee for their postings (which you could bill to a credit card), or you might let them post entries for free and then generate revenues through advertisements. By following the content that Chapter 15 presents, you can implement a web service that manages usernames and passwords. The Jobs web service uses the ValidatePassword method that simply compares the username and password to the constants (as shown in Listing 16.1 in the next section).
Based on the method you want to use to control user access, you can modify the ValidatePassword method accordingly. Most sites, for example, use a database to maintain usernames and passwords. Within the ValidatePassword method, you can integrate database operations similar to those discussed in Chapter 7, “Connecting Web Services to Databases,” to look up usernames and passwords.