Ryan - Do you know which line it causes the server to spike out?
I'd suggest trying to run it line by line until you can identify the culprit... >From looking at it, it looks okay... but who knows? Mark -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ryan Sabir Sent: Wednesday, 31 March 2004 5:16 PM To: CFAussie Mailing List Subject: [cfaussie] Any CF Java gurus online? Hi All, On my hunting around the net I found a chunk of code that will post raw xml data to a server. I'm trying to get it to work and all that happens when I try to call it is the CPU utilisation of cfserver goes up to 99% and the page hangs. I've installed JVM 1.4.2 on the server and set the "Java Virtual Machine Path" to C:\Program Files\Java\j2re1.4.2_04\bin\client\jvm.dll Are there any other settings I need to fiddle with? The code I'm using is posted below if you care to have a peek. TIA function RawPost(urlString,messageString) { // Variables var oURL = ""; var oPage = ""; var oInputStream = ""; var oOutputStream = ""; var oConnection = ""; var oReader = ""; var oWriter = ""; var oBuffer = ""; var sLine = ""; var sOutput = ""; // Init class oURL = CreateObject("java", "java.net.URL"); oWriter = CreateObject("java", "java.io.OutputStreamWriter"); oReader = CreateObject("java", "java.io.InputStreamReader"); oBuffer = CreateObject("java", "java.io.BufferedReader"); // Create URL Instance oInstance = oURL.init(urlString); // Open URL Connection oConnection = oInstance.openConnection(); oConnection.setDoInput(true); oConnection.setDoOutput(true); oConnection.setUseCaches(false); oConnection.setAllowUserInteraction("false"); oConnection.setFollowRedirects("false"); oConnection.setRequestMethod("POST"); nContentLength = JavaCast("string",Len(messageString)); oConnection.setRequestProperty("HOST",CGI.REMOTE_HOST & ":80"); oConnection.setRequestProperty("CONTENT-LENGTH",nContentLength); oConnection.setRequestProperty("ACCEPT","*/*"); oConnection.setRequestProperty("USER_AGENT",CGI.HTTP_REFERER); oOutputStream = oConnection.getOutputStream(); oWriter.init(oOutputStream); oWriter.write(messageString); oWriter.flush(); oWriter.close(); // Get stream oInputStream = oConnection.getInputStream(); oReader.init(oInputStream); oBufferStream = oBuffer.init(oReader); sLine = oBuffer.readLine(); while (IsDefined("sLine")) { sOutput = sOutput & sLine; sLine = oBuffer.readLine(); } // Close stream (Close method doesn't seem to work too well here?) // Don't know if setting to nothing closes it or not, figure that out later... oInputStream = ""; oConnection.disconnect(); // Parse Response sOutput = XMLParse(sOutput); return sOutput; } ----------------------- Ryan Sabir Newgency Pty Ltd 2a Broughton St Paddington 2021 Sydney, Australia Ph (02) 9331 2133 Fax (02) 9331 5199 Mobile: 0411 512 454 http://www.newgency.com/index.cfm?referer=rysig --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004 --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia http://www.mxdu.com/ + 24-25 February, 2004
