Good morning all, I'm trying to write a java custom tag to do a simple http post and read the response into a variable, I'm getting the same error no matter what method I try.
Basically it's for posting small xml packets to an SMS service provider. I've tried this with 20+ differnet url's, all of which exist. Error; ----------------------------------------------- java.io.FileNotFoundException: http://localhost/public/sms/smsin.cfm. Java exception occurred in call to method. ----------------------------------------------- What I don't undestand is why it would say file not found when I'm opening a connection to a url, not a file? Are there any java experts out there that can give me some advice? Code follows; sendMessages.class ----------------------------------------------- import com.allaire.cfx.* ; import java.net.*; import java.io.*; public class sendMessages implements CustomTag { public void processRequest( Request request, Response response ) throws Exception { // validate that required attributes were passed if ( !request.attributeExists( "XMLDATA" ) ) { throw new Exception( "Missing attribute ( XMLDATA is a " + "required attribute for this tag)" ) ; } String strName = request.getAttribute( "XMLDATA" ); URL url = new URL("http://localhost/public/sms/smsin.cfm"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.setDoInput (true); connection.setUseCaches (false); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); PrintWriter out = new PrintWriter(connection.getOutputStream()); out.println("XMLDATA=" + strName); out.close(); BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); String inputLine; String ReturnXML = ""; while ((inputLine = in.readLine()) != null) { ReturnXML = ReturnXML + inputLine; } in.close(); response.setVariable( "ReturnXML" , ReturnXML ); response.write(ReturnXML); } } ----------------------------------------------- Sorry for the slight OT post, but at least it's a java CFX. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

