Forum Replies Created
-
AuthorReplies
-
Here is what I did to determine the Trx id in XML: On the Inbound tab of the thread, make the “Trx id determination Format” Fixed Record Layout (frl). Then click the Edit button and make the Offset parameter range large enough to encompass the data in the message that will allow you to determine the message type. This range is zero based so I set mine from 0 to 500.
On the Route Messages tab, add a new route. For the Name parameter, key a “wildcard” text string that will allow you to determine the Trx id. For example, I was looking for the string
in the XML so I entered .* .* as the Name parameter. Note the period at the front of the string. I’m not sure why that is necessary but it did not work without it. Make sure the Wild Card Route checkbox is checked. Finally, add a new route detail for your wild card route. This is handled just like any other route detail. For mine, I used an Xlate. My actual translation script uses the XML schema even though I defined it as FRL for the sake of routing.
Just to give credit where it’s due, I did get help from Charlie Bursell and the Quovadx support team in getting this to work.
Hope this helps.
August 30, 2006 at 6:09 pm in reply to: wanting example tcl proc for sending alert info to emails #59539If you go on the Clovertech website and search for SMTP, you will find a post from John Harvey titled “working with email alerts” that gives you an example of the TCL proc you are looking for. I expanded on his proc slightly by adding a “From Address” parameter… see sendEmailMessage proc below.
proc sendEmailMessage {fromaddr recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -recipients $recipient -servers
-
-debug 1 -originator $fromaddr
mime::finalize $token
return
}
Here is the TCL proc that calls the sendEmailMessage proc. I call this from within my .bat file using the command “call tcl -c censusAlert”.
proc censusAlert {} {
sendEmailMessage “DoNotReply@abc.com” “jdoe@abc.com” “10.1.5.123” “Quovadx Census Alert!” “Interface for Census is down!”
sendEmailMessage “DoNotReply@abc.com” “kbrown@abc.com” “10.1.5.123” “Quovadx Census Alert!” “Interface for Census is down!”
}
You need to have tcllib installed in order to use the API to send email. You can find the download and instructions at
<a href="http://www.tcl.tk/software/tcllib/” class=”bbcode_url”>http://www.tcl.tk/software/tcllib/
It took me a little while to get all this installed and working but it’s a great tool now.
Here is the link: To receive the email digests, log in to the Clovertech site and click on the Digests button at the top. You can then select which digests to receive. I finally got this to work using the following: Created a new message using the following:
set newmsg [msgcreate -recover -class protocol -type data $httpBody]
msgmetaset $newmsg DESTCONN $HciConnName PRIORITY 5120 SOURCECONN $HciConnName
The variable $httpBody contains the XML response from the web server.
I then used the OVER disposition to send this message back to the inbound queue of this thread:
lappend dispList “OVER $newmsg”
This seems to work OK. I had to use Tcl to strip some extraneous tags out of the XML since I was getting the XML back wrapped in a SOAP message. Thanks for the assistance!
Todd, We have used the Tcl mime and SMTP packages to send email. Here is a link that I found helpful to review:
http://www.oche.de/~akupries/soft/mail/mime.html The Tcl proc we use is the following:
proc sendEmailMessage {fromaddr recipient email_server subject body} {
package require smtp
package require mime
set token [mime::initialize -canonical text/plain -string $body]
mime::setheader $token Subject $subject
smtp::sendmessage $token -recipients $recipient -servers
-
-debug 1 -originator $fromaddr
mime::finalize $token
return
}
The variable “email_server” needs to be a valid email server. You could modify this to pass a list of servers if needed. We pass the actual IP address of the server although I’m sure you could pass the server name as well.
The “recipient” variable can actually contain multiple email addresses… I’m assuming a comma separated list but I haven’t tried that yet.
I finally got this to work using the following: Created a new message using the following:
set newmsg [msgcreate -recover -class protocol -type data $httpBody]
msgmetaset $newmsg DESTCONN $HciConnName PRIORITY 5120 SOURCECONN $HciConnName
I then used the OVER disposition to send this message back to the inbound queue of this thread:
lappend dispList “OVER $newmsg”
This seems to work OK. Thanks for the assistance!
Charlie, Thanks for the tips. I set the SKIPXLT to 1 and set the DESTCONN to the same thread name as I’m using for the outbound message. Even though I use the SEND disposition for the new message, I never see it appear as an inbound message. Here is the message dump for the new message. See any obvious problems? Since this message is created in the Driver Control TPS, will it still SEND the new message back into the same thread? msg: 0x0083C540
msgType : DATA
msgClass : PROTOCOL
msgState : Unknown: 0 (0)
msgPriority : 5122
msgRecoveryDbState: 2
msgFlags : 0x8002
msgMid : [0.0.2808318]
msgSrcMid : [0.0.2808241]
msgSrcMidGroup : midNULL
msgOrigSrcThread : hcs_test_hl7
msgOrigDestThread : CaretrackerQuery_Test_XML
msgSrcThread : CaretrackerQuery_Test_XML
msgDestThread : CaretrackerQuery_Test_XML
msgXlateThread :
msgSkipXlate : 1
msgSepChars :
msgNumRetries : 0
msgGroupId : 0
msgDriverControl :
msgRecordFormat :
msgRoutes :
msgUserData :
msgStaticIsDirty : 1
msgVariableIsDirty: 1
msgTimeStartIb : 1144243771.968
msgTimeStartOb : 1144243772.265
msgTimeCurQueStart: 0.000
msgTimeTotalQue : 0.000
msgTimeRecovery : 1144243773.890
msgEoConfig : 0x00000000
msgData (BO) : 0x0083C5EC
message : My message data
Mike, thanks for the response. I did look at your code before posting my question. I don’t see where you actually pass any information retrieved from the web service back to the Quovadx engine. I’m certainly not a Tcl expert so I may be missing something. The web service I’m calling sends back data in XML form that I then need to send back through the engine to the server that originally sent the request. Can you be specific about what I would need to do in the schema to indicate that it is repeating? Filter already looks like the following: I did play around with using Iterate and some Tcl to get the correct format coming out but it is kind of messy. Thanks.
Success! The -originator parameter you provided me did solve the problem I was having. I was doing something else stupid in the Tcl proc that was giving me an error. Thanks much for the assistance! John, thanks for your reply. I tried your suggestion with adding the originator and now I get the following error back after about a 10 minute delay: [pd :pdtd:ERR /0:qs1_census_hl7] Tcl error:
msgId = message0
proc = ‘filterRxCensus’
args = ”
result = ‘can’t read “response”: variable is array’
errorInfo: ‘
can’t read “response”: variable is array
Anyone have any clues?
I must have had some problem in my field mapping. I made some changes to the XLT and the error is not occurring… or at least it’s not stopping my translation. I’m not going to worry about it at this point. Thx. When I looked at the syntax of lsearch on the internet, it shows the -all option but when I looked at the Help text in TCL on my Quovadx server, it does not show the -all option. In any case, I reworked the code to iterate through the AL1 segments as you suggested and it is working fine now. Thanks for the responses! -
AuthorReplies