Reply To: HL7 Messages Posted to a Webservice

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf HL7 Messages Posted to a Webservice Reply To: HL7 Messages Posted to a Webservice

#59851
Pete Gilbert
Participant

    I ended up coding this using curl (because the httpquery package wouldn’t allow me to configure the http headers properly). We are actually sending an HL7 2.x message in a SOAP wrapper. I ended up handling the errors like this:

    if {[catch {curl::transfer -url $url

                   -post 1

                   -httpheader $httpHeader

                   -postfields $soapEnv

                   -httpauth basic

                   -userpwd $useridpw

                   -verbose 0

                   -sslverifypeer 0

                   -infohttpcode httpcode

    -errorbuffer error

                   -bodyvar httpResponse } ]} {

    echo “***ERROR from tclcurl sending to REMOTE. Error is ” $error

    sleep 30

    return “{ERROR $mh}”

    }

    #

    # a returncode of 200 is success.

    #

           if {$httpcode == 200} {

                   echo “Message was successfully sent to REMOTE”

           } else {

                 echo “*** Error sending to REMOTE”

                 echo $httpcode          

                 echo $httpResponse

       echo “Original Message from LAB:”

       echo $msg

       echo “Soap Envelope that was sent to REMOTE:”

       echo $soapEnv

       sleep 30

       return “{ERROR $mh}”

           }

                   

              return “{CONTINUE $mh}”      

    }

    Note that because I am doing this in a UPOC, returning ERROR actually puts the message into the recovery database and it will try to resend. I am told that this is a feature 🙂 So, if there is an error (like the remote server is down, or it thinks the message is invalid), we queue up and keep on trying. This will cause the thread to back up, and our operators will notice and we will start troubleshooting.