Chapter 22. Case Study: Payment Calculator — Ruby on Rails

Throughout this book, you have learned how XML can be used to construct and validate documents and how it is used for communications between systems. You have also learned how to use several important XML display formats. Sometimes it can be difficult seeing how all of these technologies fit together without a real-world business case. This case study demonstrates how you can build an online home loan calculator using a public web service, a Ruby on Rails web application, JavaScript, and several of the XML technologies you have learned.

In this chapter, you will:

  • Create a Ruby on Rails application.

  • Create a web page to enter loan information.

  • Call a web service to calculate the payments using SOAP.

  • Display the results using Ajax (Asynchronous JavaScript and XML) and SVG.

Mortgage Calculations

Mortgages are commonly used throughout the world when purchasing a home or land. The word "mortgage" comes from French and literally means "death pledge." Before making such a pledge, the consumer often wants to see what the proposed payments for the loan would be. The payments may generally include interest and a principal reduction component, depending on various laws or religious guidelines.

In the most common mortgages, the schedule of payments (based on a repayment agreement or Note) must be determined before the annual percentage rate (APR) can be calculated. The amount of interest and principal paid in each payment is based on the loan ...

Get Beginning XML, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.