SUPERSIMP – A Super Simple RPGLE program to return a success code and a message
Copy and paste the previous code into your IBM i Code Editor of choice.
I placed the code in library NLITTEN and source file QRPGLESREC and member SUPERSIMP
To compile it we use the create bound rpg command:
CRTBNDRPG PGM(mylibrary/SUPERSIMP)
SRCFILE(mylibrary/QRPGLESRC)
SRCMBR(SUPERSIMP)
Once compiled - What's Next?
- Create a WebServer
- Add a Webservice (using our new SUPERSIMP program)
- Test that Webservice
What do we need to accomplish this?
Before we create our webserver, we need to decide what protocol we will use for it. The old standard was SOAP, but for recent years REST has really taken over.
What is the differerence between these standards?
- SOAP is a protocol that defines a standard way of exchanging messages between applications using XML. REST is an architectural style that defines a set of principles for designing web services that use HTTP methods and URIs.
- SOAP uses a WSDL file to describe the service interface, operations, and parameters. REST does not require a WSDL file, but can use other formats such as Swagger or OpenAPI to document the service.
- SOAP supports only XML as the data format for messages. REST supports multiple data formats such as JSON, HTML, Plain text, and XML.
- SOAP requires more bandwidth and resources than REST, as it has a complex structure and adds additional headers to the messages. REST is more lightweight and efficient, as it uses simple HTTP requests and responses.
- SOAP defines its own security standards, such as WS-Security, WS-Trust, and WS-Policy. REST relies on the underlying transport layer for security, such as HTTPS, SSL, and TLS.
XML and JSON - what is that?
XML might look like this:
<myinfo>
<name>Nick</name>
<surname>Litten</surname>
<email>nick@nicklitten.com</email>
</myinfo>
The same in JSON might look like this:
{
"myinfo": {
"name": "Nick",
"surname": "Litten",
"email": "nick@nicklitten.com"
}
}
Let's choose REST and JSON for our webservice, and dive into the next set of questions:
- How do we create a Webserver?
- How do we Test a Webserver?
Jump to the next lesson to find out!