Originally posted by Todd Yingling
Originally posted by Mike Shoemaker
package require httppackage require WebServiceAckNakproc webServiceConn { inData inUrl inParam } { set html "" set url $inUrl set xml_data $inData set queryParam $inParam set query2 [::http::formatQuery $queryParam $xml_data] if {![catch {set http [::http::geturl $url -query $query2]} error_msg ]} { set html [::http::data $http] upvar #0 $http status foreach index [array names status] { switch -exact -- $index { querylength { set query_len [array get status $index] } currentsize { set response_len [array get status $index] } http { set http_status [array get status $index] } default { } } } set http_status [lindex $http_status 1] set ackNak [webServiceAckNak $http_status $html] return $ackNak } else { echo "error has been encountered::$error_msg" } if {$html != ""} { [::http::cleanup $html] }}
proc webServiceAckNak { inHTTP inHTML } { set result "" set httpResponse $inHTTP set htmlResponse $inHTML set htmlResponseString [lindex [split $htmlResponse n] 1] regexp >(.*?)</string> $htmlResponseString match result if {$result == "working"} { return 0 } else { echo $htmlResponse echo $httpResponse }}
set res [webServiceConn $msg $url $queryParameter] if {$res == 0} { set status_cond 1 echo "Message Sent Successfully." } else { set status_cond 0 echo "An error has been encountered with the webservice connection. Retrying...COUNT: $counter" }