Initializing help system before first use

Calling a DMP Webservice

You can also use of the dmp module to send HTTP requests to a SERVERLESS_REST type webservice in the same solution. To do this, you first initialize a dmpresource value with the details of the webservice you want to talk by calling dmpinitwebservice, then use the dmphttp functions to send HTTP requests in a similar way to using plain mmhttp. For example, you can send a request to a webservice called processLoanApps as follows:

declarations
  myservice: dmpresource
end-declarations
dmpinitwebservice(myservice,'processLoanApps')
if myservice.status<>DMP_OK then
  writeln('Failed to find service due to error:', myservice.lasterror)
  exit(1)
end-if

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

When calling a webservice, you will typically leave the path field as an empty string.