In an earlier question to the forum, I was asking if there is a Documaker api that could be called that would return ERRS and LOGS for a given Trn_Id (there is not). So I got to thinking about creating my own custom rule that could:
- Receive the TrnErrId in the request
- Query the ERRS table for that TrnErrId
- Put the query results into the response
For now, I am just using javascript because it's quick, but I will eventually me migrating it to java. I need help getting this set up and I am struggling with reading and setting message variables. My current configuration is as follows:
I added the following to the idmk_java_requests.ini file:
[ReqType:ERRS]
; Returns ERRS and LOGS for a given TRN_ID
function = atcw32->ATCLogTransaction
function = atcw32->ATCLoadAttachment
function = atcw32->ATCUnloadAttachment
function = dprw32->DPRSetConfig
function = script;getErrors.js;runRule
function = java;com.docucorp.ids.rules.CopyDataRule;copyit;transaction;copyMessageVariables;TAG_AND_FOLLOW,CONFIG,TrnErrId,ErrResults
And my javascript file (getErrors.js) looks like this:
function runRule(requestState, idsArgs, idsMessage) {
switch (idsMessage) {
case IDSConstants.init :
break;
case IDSConstants.runForward :
requestState.getOutput().getMsgVar("TrnErrId");
requestState.getOutput().setMsgVar("ErrResults", "TEST");
break;
case IDSConstants.runReverse :
requestState.getOutput().getMsgVar("TrnErrId");
requestState.getOutput().setMsgVar("ErrResults", "TEST");
break;
case IDSConstants.terminate :
break;
}
return IDSConstants.success;
}
and my SOAP request looks like this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:com="oracle/documaker/schema/ws/composition" xmlns:com1="oracle/documaker/schema/ws/composition/common" xmlns:v1="oracle/documaker/schema/ws/composition/doCallIDS/v1" xmlns:com2="oracle/documaker/schema/common" xmlns:req="oracle/documaker/schema/ws/composition/doCallIDS/v1/request">
<soapenv:Header/>
<soapenv:Body>
<com:DoCallIDSRequest>
<com:DoCallIDSRequestV1>
<com1:timeoutMillis>30000</com1:timeoutMillis>
<v1:IDSRequest>
<req:DSIMSG>
<com1:MSGVARS>
<com1:VAR NAME="ReqType">ERRS</com1:VAR>
<com1:VAR NAME="TrnErrId">12345</com1:VAR>
</com1:MSGVARS>
</req:DSIMSG>
</v1:IDSRequest>
</com:DoCallIDSRequestV1>
</com:DoCallIDSRequest>
</soapenv:Body>
</soapenv:Envelope>
I can get it to run and my result returns the TrnErrId but not the new one that I am trying to add (ErrResults).
Any thoughts would be much appreciated.
Dave