› Clovertech Forums › Cloverleaf › Trying to send dynamic address to a FHIR connection using ws-rawclient protocol
We are currently in development to pull med administrations out of Cerner via a FHIR connection. We currently use cloverleaf to establish this connection which I’ve been able to successfully get working with the Cerner sandbox. I’m using a java/ws-rawclient protocal with the Cerner sandbox address. (see screen shot) However, I’ve been having to hard code the patient ID in order to retrieve data. I want to be able to establish a dynamic address in order to trigger the connection. Has anyone been able to do this with using cloverleaf? THANKS!!
You’ll have to edit the metadata of the message before it’s sent outbound using a TCL script, specifically the USERDATA httpRequestInfo keyedlist. You’ll need to override the requestURL key.
We put our script in Route Messages on the route itself.
Steps:
Create the new URL you want to send the message to like so, for example:
set userData {{httpRequestInfo {{requestURL <NEW URL>}}}}
Then set the message’s metadata like so:
msgmetaset <message handle> USERDATA $userData
Then CONTINUE the message to it’s destination.
You may want to use the TCL keyedlist commands because the way we have it setup in our script the URLs are known & hard-coded which is why we’re using braces. We have only 3 we need, but in your case you’re setting it based on patient IDs so you don’t know them beforehand. You’ll need those TCL keyedlist commands such as keylkeys, keylget, keylset, etc so you can be more dynamic.
This is great stuff and totally saved my day.
Where in the documentation do you find the udata which is used by the WS protocol? (or by any other protocol for that matter) I’ve tried finding it, because I was certain that something like requestURL would exist. But guessing the name was out of my reach 🙂
Thanks.
Glad it was helpful!
Cloverleaf documentation really lacks and their WebService adapter is very bare-bones, you have to do a lot of the work through scripts. Not sure why Cloverleaf doesn’t provide adequate documentation. Perhaps they want you to use their “consulting services”.
I found out through trial and error and also the very helpful command, msgdump. I used that command in my script to output message info to the log, including all metadata so that’s where I saw the requestURL key.
Hi Tipu,
This has been very helpful information. I’ve tried creating a very basic tclproc that I’ve been running on the outbound tab. Below is the main body of my tcl and the Error message I’m getting. Do you happen to have an suggestions?
For POC, I was just hard coding my medication value into the URL to see if I could get it to work that way.
Main part of the tcl:
keylget args MSGID mh
lappend dispList “CONTINUE $mh”
# Get the message content and HL7 Control characters
set msgData [msgget $mh]
set fieldsep [string index $msgData 3]
set compsep [string index $msgData 4]
set repsep [string index $msgData 5]
# set meta [msgmetaget $mh USERDATA]
# echo meta: $meta
set myURL “https://fhir-open.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/MedicationAdministration/”
append myURL “7283373”
set userData “{httpRequestInfo {requestURL $myURL}}”
echo myURL: $myURL
msgmetaset $mh USERDATA $userData
echo [msgmetaget $mh USERDATA]
msgset $mh “”
This looks like it builds the URL perfectly, but it’s throwing a Bad Data error and sending my URL to the error DB.
msg: 0x0x7f78492ba078
msgType : DATA
msgClass : PROTOCOL
msgState : Bad data (419)
msgPriority : 5120
msgRecoveryDbState: Log:update (3)
msgFlags : 0x8002
msgMid : [0.0.30842]
msgSrcMid : [0.0.30840]
msgSrcMidGroup : midNULL
msgHostId : 3278342957
msgOrigSrcThread : Reply_CERT2
msgOrigDestThread : Cerner_CERT2
msgSrcThread : Reply_CERT2
msgDestThread : Cerner_CERT2
msgXlateThread :
msgSkipXlate : 0
msgSepChars :
msgNumRetries : 0
msgGroupId : 0
msgDriverControl : {_TRXID_ _HCI_static_route_}
msgRecordFormat :
msgRoutes :
msgUserData : {httpRequestInfo {requestURL https://fhir-open.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/MedicationAdministration/7283373}}
msgStaticIsDirty : 0
msgVariableIsDirty: 0
msgRetryTimes :
msgTimeStartIb : 1579899178.718(Fri Jan 24 15:52:58 2020)
msgTimeStartOb : 1579899178.968(Fri Jan 24 15:52:58 2020)
msgTimeCurQueStart: 0.000(Wed Dec 31 19:00:00 1969)
msgTimeTotalQue : 0.005
msgTimeRecovery : 1579899178.966(Fri Jan 24 15:52:58 2020)
msgEoConfig : 0x(nil)
msgData (BO) : 0x0x7f78492ba238
message : ”
Log File:
[java:java:ERR /1:Cerner_CERT2_0:01/24/2020 15:52:59] com.infor.cloverleaf.gjdws.WSRawClient processMessageFromCloverleaf:SEVERE: Caught exception trying to process message from Cloverleaf
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] Catch Execption:
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] at com.infor.cloverleaf.gjdws.WSRawClient.processMessageFromCloverleaf(WSRawClient.java:132)
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] at com.lawson.cloverleaf.driver.FromCloverleafLink.doMsg(FromCloverleafLink.java:46)
[java:wrte:ERR /0:Cerner_CERT2_0:01/24/2020 15:52:59] Call to “doMsg” returned error string “BADDATA caught exception trying to processMessageFromCloverleaf: caught exception trying to process message from Cloverleaf”. Returning bad send to engine.
I think it’s this part: msgset $mh “”
You’re setting the message to null. You need to the set it the message you’re working with. If you’re not modifying the content at all, then you can just comment that line out. Try it that way since you seem to only be modifying the message metadata (not the actual data)
I am actually passing it a message to basically just “trigger” the process. Right now, I’m not sending any real data and you are correct that I don’t really care about that actual data right now. I just want to be able to build and pass the URL.
I commented out the msgset $mh “” and it’s still saying BAD DATA, but the error db now includes my very basic message data ($mh).
java:java:ERR /1:Cerner_CERT2_0:01/24/2020 16:30:38] com.infor.cloverleaf.gjdws.WSRawClient processMessageFromCloverleaf:SEVERE: Caught exception trying to process message from Cloverleaf
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] Catch Execption:
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] at com.infor.cloverleaf.gjdws.WSRawClient.processMessageFromCloverleaf(WSRawClient.java:132)
[java:java:ERR /1:Cerner_CERT2_0:–/–/—- –:–:–] at com.lawson.cloverleaf.driver.FromCloverleafLink.doMsg(FromCloverleafLink.java:46)
[java:wrte:ERR /0:Cerner_CERT2_0:01/24/2020 16:30:38] Call to “doMsg” returned error string “BADDATA caught exception trying to processMessageFromCloverleaf: caught exception trying to process message from Cloverleaf”. Returning bad send to engine.
msg: 0x0x7ff6bfc40078
msgType : DATA
msgClass : PROTOCOL
msgState : Bad data (419)
msgPriority : 5120
msgRecoveryDbState: Log:update (3)
msgFlags : 0x8002
msgMid : [0.0.30846]
msgSrcMid : [0.0.30844]
msgSrcMidGroup : midNULL
msgHostId : 3278342957
msgOrigSrcThread : Reply_CERT2
msgOrigDestThread : Cerner_CERT2
msgSrcThread : Reply_CERT2
msgDestThread : Cerner_CERT2
msgXlateThread :
msgSkipXlate : 0
msgSepChars :
msgNumRetries : 0
msgGroupId : 0
msgDriverControl : {_TRXID_ _HCI_static_route_}
msgRecordFormat :
msgRoutes :
msgUserData : {httpRequestInfo {requestURL https://fhir-open.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/MedicationAdministration/7283373}}
msgStaticIsDirty : 0
msgVariableIsDirty: 0
msgRetryTimes :
msgTimeStartIb : 1579901438.057(Fri Jan 24 16:30:38 2020)
msgTimeStartOb : 1579901438.275(Fri Jan 24 16:30:38 2020)
msgTimeCurQueStart: 0.000(Wed Dec 31 19:00:00 1969)
msgTimeTotalQue : 0.005
msgTimeRecovery : 1579901438.272(Fri Jan 24 16:30:38 2020)
msgEoConfig : 0x(nil)
msgData (BO) : 0x0x7ff6bfc40238
message : ‘{\x0a\x09″resourceType”:”MedicationAdministration”,\x0a\x09″subject”:{\x0a\x09},\x0a\x09″_id”:{\x0a\x09\x09″id”:””\x0a\x09}\x0a}’
THANKS!!
I’ve included some screen shots of the basic set up that I’m using. It’s totally bare bones, but I’ve been trying to just get the concepts to work before I really get into building it out.
How are your threads setup? Are you sending to a Client Raw thread? Do you have a java/ws server thread?
We have a java/ws-server thread that accepts incoming webservice calls and routes them to the appropriate outbound java/ws-rawclient threads.
Right now, I just have the inbound thread set to read a file. I haven’t set up receiving a thread that accepts inbound calls. I am routing it to a java/ws-rawclient thread. I’ve included screen shots in my last post that might help explain what I’m trying to do. This is more of a POC right now so it’s pieced together while I work on getting it to work.
Hello
I don’t know if you ever solved this problem, but I have the exact same issue.
Did you find a solution
/Torfinn
Hi Torfinn,
We did finally solve this issue. Infor had supplied a “test” site called “dtcsample” which included examples of DTC processing and some FHIR processing. As a part of that sample site, they provided some tclprocs as well. One of them is called tpsFhirSetServerUrl and this will help you set up the dynamic URL. We did have to modify it for our own use, but this should help you get started. Initially we had it set up as a post tps which passed the dynamic URL to our PROTOCOL:java/ws-rawclient thread.
Hopefully this will help you. We struggled for a very long time before we found this proc. We tried several other things including global variables, but we could never make it work any other way. Good Luck!!
Marla
Hi Marla,
Thanks for the info. Where can i get my hands on this dtcsample site? Did you have to go to Infor directly for it or is it hidden here somewhere and i can’t find it? I’m currently on ver 6.2.4 and it’s not a sample site that comes with it. Thanks,
Feda
Hi Marla
Running into the same issue
Would it be possible to share the tpsFhirSetServerUrl proc?
Was this on your Cloverleaf server(s) or did Infor have to provide it?
We’re on v19.1
Thanks
Hello Marla,
We are beginning to play with FHIR configurations. We are a Cerner client and are using Cloverleaf as well. There are times we are looking for better ways to pull information from Cerner than using jdbc.
I know the process for registering an app and providing a redirect url for fhir apps with Cerner. In this case where the request would be from Cloverleaf were you able to set it up for provisioning and the oAuth2 token to make a GET request to Cerner? I haven’t found any documentation on how that would be achieved.
Any information you may have would be appreciated.
This is extremely valuable info. Thanks for sharing this.
I usually get bad data errors when resending the message form smat or if the reply doesn’t have an endpoint. Try to send the message from the thread it will be routed from using an external client, like HL7Spy or SOAPUI. Basically, if the IB message that is routing the message is trying to send a reply but doesn’t have any where to send to since it was resent via SMAT
Disregard, intended for a different topic thread.