Calling a DMP Component
The most common use of the dmp module will be to send HTTP requests to another component in the same DMP solution. To do this, you first initialize a dmpresource value with the details of the target component by calling dmpinitcomp, then use the dmphttp functions to send HTTP requests in a similar way to using plain mmhttp. For example, in an Xpress Insight app, you can send a webservice request to the status endpoint of an Xpress Executor component in the same solution as follows:
declarations mycomp: dmpresource end-declarations dmpinitcomp(mycomp,'Xpress Executor') if mycomp.status<>DMP_OK then writeln('Failed to find component due to error:', mycomp.lasterror) exit(1) end-if httpStatusCode := dmphttpget(mycomp,'/rest/runtime/status','result.json') if httpStatusCode<>200 then writeln('Error returned by component: ',httpStatusCode) exit(1) end-if
The path you pass to the the dmphttp function will be relative to the root of the component instance URL.
When executed from a DMP component, the dmp module will take care of obtaining appropriate authorization credentials and including them in the outgoing HTTP requests.