Groovy script not getting POST response

I have a page that when it is edited, before it is saved, the user needs to be verified through our in house database. I have a web service that will return a true/false value when passed the data via a POST.

I can capture the DocumentUpdateEvent which is where I would like to check for validity. Everything appears to be working fine but it does not appear to be running the POST. I am using Groovy. Here is the segment of code that I am using:

        def post = new URL("https://QC/Inspection.asmx/IsSignatureValid").openConnection();
        def message = "empID=${empID}&empPIN=${empPin}"

        document.setContent("${document.getContent()}\nmessage:${message}")

        post.setRequestMethod("POST")
        post.setDoOutput(true)
        post.setRequestProperty("Content-Type", "application/x-www-form-urlencoded")
        post.getOutputStream().write(message);
        def postRC = post.getResponseCode();

** This line does not appear to run - or least no output is added.
document.setContent("${document.getContent()}\nResponse Code:${postRC}")

        if(postRC.equals(200)) {
          document.setContent("${document.getContent()}\nResponse:post.getInputStream().getText()")
        }

As usual any insight would be appreciated.

–Steve

Found out that an error was being thrown but I was not seeing it. The line

post.getOutputStream.write(message)

is invalid. It should be

post.outputStream.withWriter { writer ->
writer << message
}