Hi Scott.
I’ve been involved with a few Cloverleaf web services projects, with translations
from to
XML -> XML,
XML -> HL7,
XML -> various and
various-> XML
I’ve been using the Cloverleaf GRM interface within TCL scripts and that works pretty well. I’ve written some library for most of the operations (unfortunately unable to share).
I’ve found that my testing time is a lot longer when working with XML as the document MUST be valid to extract data. I’m working with multiple ‘imports’ so management of the XML files can also be tricky!
In my scripts, I’ll validate all the schemas I intend to use at startup.
eg
#
# Verify that the XML schemas exits prior to using them
#
lappend mySchemaList {GDS-Document StoreDocument_output}
{GDS-Document SubmitWorkFlowStatus_output}
{GDS-Document VoidDocument_output}
{HCAL-Message-Core HcalFault_soap}
{HCAL-Message-Core Fault_soap}
CheckSchema GlobGCDA$HciConnName $mySchemaList
When grabbing elements from an instantiated message, I set a ‘pointer’ and then
#
# This has a standard structured ‘detail’ so we grab the
# elements we are interested in
#
set myPtr SOAP-ENV:Envelope.SOAP-ENV:Body.SOAP-ENV:Fault.
set myFaultCode [GetElement $myXml ${myPtr}faultcode]
set myFaultString [GetElement $myXml ${myPtr}faultstring]
set myFaultActor [GetElement $myXml ${myPtr}faultactor]
set myErrorCode [GetElement $myXml ${myPtr}detail.core:StandardError.core:errorCode]
set myErrorMessage [GetElement $myXml ${myPtr}detail.core:StandardError.core:message]
with library code below – note that GetElement2 is does not use the ‘catch’, so an errors are found! ….
proc GetElement {aGrmHandle aPtr} {
set myDat {}
if {[catch {set myDat [grmfetch $aGrmHandle ${aPtr}.#text]}] == 0} {
set myDat [datget $myDat VALUE]
}
return $myDat
}
proc GetElement2 {aGrmHandle aPtr} {
set myDat {}
set myDat [grmfetch $aGrmHandle ${aPtr}.#text]
set myDat [datget $myDat VALUE]
return $myDat
}
I hope this helps as bit!