Initializing help system before first use

Error handling

You should always check the status attribute of the dmpresource after every dmpinit call, to see if it succeeded or not. This status will be DMP_OK on success, DMP_NOT_FOUND if the resource you requested did not exist, DMP_ACCESS_DENIED if you don't have access to the resource you requested; any other values indicate internal errors. When the status is not DMP_OK, you can find a human-readable error message in the lasterror attribute. For example:

declarations
  myservice: dmpresource
end-declarations
dmpinitwebservice(myservice,'processLoanApps')
if myservice.status=DMP_OK then
  writeln('Service found OK')
elif myservice.status=DMP_NOT_FOUND then
  writeln('Service not found')
else then
  writeln('Failed to find service due to error:', myservice.lasterror)
end-if

httpStatusCode := dmphttppost(myservice,'','request.json','result.json')
if httpStatusCode<>200 then
  writeln('Error returned by webservice: ',httpStatusCode)
  exit(1)
end-if