Originally posted by Craig Berkley
Originally posted by Jesse Pangburn
proc ins_BPMS_PostMsg { url xml x12 } { set newline "x0Dx0A" set outputData {} set bound "-----NEXT_PART_[clock seconds].[pid]" # add the x12 file contents to the data to upload append outputData "--$bound${newline}Content-Disposition: form-data; name="QDXResponseX12"; filename="X12";${newline}Content-Type: application/edi-x12${newline}${newline}$x12${newline}" # add the xml data to the data to upload append outputData "--$bound${newline}Content-Disposition: form-data; name="QDXResponse"${newline}${newline}$xml${newline}" # add the signal that the upload is done append outputData "--${bound}--${newline}" set cfg [list [list URL $url] [list DATA $outputData] [list HEADERS [list [list CONTENT-TYPE "multipart/form-data; boundary=$bound"]]]] set res [httppost $cfg] set status [keylget res "STATUS"] set body [keylget res "BODY"] set statCode [lindex $status 1] # debug puts "CFG IS $cfg" puts "STATUS IS $status" puts "STATUS CODE IS $statCode" #puts "RESULT IS $res" if {$statCode <= 299} { puts "SUCCESS HTTP POST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" puts "" puts "" return } else { puts "FAILED HTTP POST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" puts "" puts "" return [list $statCode $body] } }