Loan Management Service is a SOAP-based web service built with C# and ASP.NET WCF (Windows Communication Foundation) for managing library loans. This project demonstrates my knowledge of C# and .NET, with a specific focus on building and consuming SOAP services using WCF.
This project is part of my journey in backend development, focusing on service-oriented architecture and SOAP web services.
The Loan Management Service is a backend system tailored to handle loan management for libraries. Using SOAP-based web services, it provides a reliable interface for operations such as creating, updating, and retrieving loan records. This project can easily integrate with other library management systems that support SOAP, making it a valuable asset for managing loans in an organized, secure, and scalable way.
- SOAP-based Web Service for consistent communication and integration with other systems.
- Service-Oriented Architecture (SOA) for modular and scalable design.
- CRUD operations for loan management, enabling users to create, update, retrieve, and delete loan records.
- C# - Core language for developing the service.
- ASP.NET WCF - Framework used to create SOAP-based services, providing interoperability with various clients.
- MySQL - Database for storing loan and user data with reliable persistence.
- Visual Studio - IDE for code development, debugging, and testing.
LoanManagementService/
├── LoanManagementService.sln # Solution file
├── Services/
│ └── LoanService.svc # Main SOAP service for loan management
├── Web.config # Configuration file (database connection, WCF settings)
└── README.md # Project documentation
- Services/LoanService.svc: The primary SOAP service that exposes operations for loan management.
- Web.config: Contains configuration settings, including database connection details and WCF-specific options for hosting the SOAP service.
Follow these steps to set up the Loan Management Service on your local machine.
- Visual Studio 2019 or later with the .NET development workload installed.
- MySQL database installed and running.
git clone https://github.com/Yassinekrn/LoanManagementService.git
cd LoanManagementService
- Open MySQL Workbench (or preferred client) and create a database named
LibraryManagement
. - Update the
Web.config
file with your MySQL credentials:<connectionStrings> <add name="LibraryDbConnection" connectionString="Server=localhost;Database=LibraryManagement;Uid=root;Pwd=root;" providerName="MySql.Data.MySqlClient" /> </connectionStrings>
- Open
LoanManagementService.sln
in Visual Studio. - Build the project to restore dependencies.
- Start debugging (F5) to host the service locally.
The Loan Management Service exposes several SOAP operations for managing loan records. Each operation can be consumed by a SOAP client and provides structured XML responses that can be easily integrated into other systems. The application has been thoroughly tested using Postman by generating a collection directly from the WSDL file.
-
IssueLoan - Creates a new loan record.
public bool IssueLoan(int userId, int bookId)
-
ReturnLoan - Updates the status of an existing loan to mark it as returned.
public bool ReturnLoan(int loanId)
-
GetLoanDetails - Retrieves full details of a loan based on its ID.
public Loan GetLoanDetails(int loanId)
-
GetAllActiveLoans - Retrieves all active loan records.
public List<Loan> GetAllActiveLoans()
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<IssueLoan xmlns="http://tempuri.org/">
<userId>100</userId>
<bookId>100</bookId>
</IssueLoan>
</soap:Body>
</soap:Envelope>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<IssueLoanResponse xmlns="http://tempuri.org/">
<IssueLoanResult>true</IssueLoanResult>
</IssueLoanResponse>
</s:Body>
</s:Envelope>
Error handling in this service is currently limited, with basic error responses embedded within the SOAP response body. When an error occurs (e.g., if a loan cannot be created or retrieved), the service returns false
. This approach provides simple feedback, and future improvements will include structured SOAP fault handling for a more robust error management approach.
- Enhanced Error Handling: Implement detailed SOAP Fault responses to provide clearer error messages to clients.
- Unit Testing: Develop unit tests for each SOAP operation to ensure reliability and correctness.
- Documentation with WSDL: Provide a well-documented WSDL file to fully describe available operations, making it easier for clients to integrate with the service.
- Yassine Krichen - Aspiring Software Engineer with a focus on backend development and .NET applications.
- LinkedIn: Yassine Krichen's LinkedIn
- GitHub: Yassine Krichen's GitHub
Special thanks to Mrs. Tayechi for her guidance and feedback throughout this project.