Joe,
I’m not sure it counts for best practices, but I learned a lot doing our first Cloverleaf to Web Service here at HealthPartners. We are using TclCurl and it works nicely. Here’s a high-level overview:
We created a tps proc with curl::transfer in the run mode. Our variables are all table-driven, so the proc is fairly generic.
set curl_status [catch {curl::transfer
-bodyvar xml_response
-errorbuffer errmsg
-infohttpcode http_return_code
-url $qry_url
-post 1
-httpheader $qry_headers
-postfields $qry_soap
} ]
We use regexp to remove the SOAP wrapper from the $xml_response leaving an XML message that could be used as the msgtxt of a reply message. (In our case we are translating the XML to an X12 271 Eligibility Query response using a Cloverleaf translation.) We record a millisecond timestamp just before and after the curl call because our customers have response time expectations and its helpful to know how much time is spent doing the query.
Then comes the error checking for the curl_status and http_return_code. There are several options here depending on your user requirements. We have done things like queue the message for later retry, create a “default” XML response message, e-mail the support team because the web service isn’t responding, etc.
At this point we can only use http, not https because Cloverleaf wants extra $$ to compile in the openSSL routines. I hope that will change in the future — for now the only option we have been offered is to purchase the Secure Messenger add-on.
Let us know how your project goes.
- Mark Thompson
HealthPartners