Example RPGLE (WEB2IFSYJL) - Testing with API Tool POSTMAN

Postman is a good choice for testing web services for several reasons:

  • Ease of use: Postman provides a user-friendly interface that makes it easy to create, send, and manage HTTP requests. This allows developers and testers to quickly set up and execute tests without having to write complex code.
  • Comprehensive features: Postman offers a wide range of features for web service testing, including support for different HTTP methods (GET, POST, PUT, DELETE, etc.), headers, query parameters, request bodies, and authentication mechanisms. It also provides features for creating test scripts, generating code snippets, and managing collections of requests.
  • Collaboration and sharing: Postman allows users to share their requests, test suites, and environments with team members, enabling collaboration and streamlining the testing process.
  • Debugging and troubleshooting: Postman provides detailed information about the requests and responses, including headers, status codes, and response bodies. This makes it easier to identify and debug issues with the web service.
  • Automation and integration: Postman can be integrated with various tools and platforms, such as CI/CD pipelines, to automate the testing process and ensure consistent and reliable testing across different environments.
  • Cross-platform compatibility: Postman is available for multiple platforms, including Windows, macOS, and Linux, making it accessible to developers and testers working on different operating systems.

Overall, Postman's combination of ease of use, comprehensive features, collaboration capabilities, and integration options make it a popular and effective choice for testing web services.

Testing the WEB2IFSYJL GET method

To test a web service method GET with Postman, you would first need to open the Postman application and create a new request. In the request, you would select the HTTP method as "GET" and enter the URL of the web service endpoint you want to test. 

You can then configure any necessary headers, query parameters, or authentication details required by the web service. Once the request is set up, you can send the request and Postman will display the response, including the status code, headers, and response body. This allows you to verify that the web service is functioning as expected and returning the expected data. 

I am expecting to see this little snippet of the code logic being processed and returned to the POSTMAN API Tester:

webservice code snippet for GET

To test my webservice I just need to enter the correct URL of the WEB2IFSYJL webservice, and include some extra details:

  • Enter the System name : port /uri-to-match-mydefinition/ webservice PGM name
  • Include some JSON in the BODY so that it can be received and written to the IFS location
  • Optionally: pass in the debug parameter

Let's include this useful chunk of testing JSON:

{ "name": "John Doe", "age": 55, "email": "john.doe@example.com", "address": { "street": "123 Main St", "city": "Anytown", "state": "NV", "zip": "12345" }, "hobbies": [ "reading", "hiking", "photography" ]}

Include JSON in Body

json in body

Set Debug value to 'Y'

postman api testing tool

Testing the POST method

Webservice(WEB2IFSYJL) failed with error - saveToStmf - Permission denied
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>