~/blog/crud-web-service-wsdl-academic-using-php-7-3
Published on

CRUD Web Service WSDL Academic Using PHP 7.3

book2 minutes read

Bash Shell Script

What is a web service? A Web Service is a method of data communication between two or more devices over a network remotely, or if we use an analogy, a web service is like a bridge between the database and the client.

WSDL, which stands for Web Services Description Language, is an XML format published to describe a function in a web service. So, if you use WSDL, you might not need to create additional documentation for the web service because the functions are already described in the WSDL itself.

Okay, let's jump to the coding part!

Create Database

Create an academic database and a student table with the following fields and types:

nim char (10)
nama varchar (50)
prodi char (5)

Download Library NuSOAP

For PHP version 7, you can download it here in the src folder.

Create akademik-service.php

First, initialize the WSDL and create its complex type

Create Data

We will create the functionality for creating student data

Read Data

We need to retrieve all data from the student table, as well as retrieve a single record for editing purposes

Retrieve all data

Retrieve a single record based on the student’s NIM

Update Data

After implementing the functions to retrieve all data and retrieve a single record by NIM, we need to implement an update function to modify data that might have been incorrectly entered

Delete Data

Of course, we also need a delete function to remove data that is no longer needed

Results

To check the results, you can open http://{hostname}/akademik/akademik-service.php?wsdl in a web browser, according to the URL namespace we created earlier, or use SoapUI to make requests to the web service

The source code can also be downloaded from GitHub.

That's all for now, see ya~