Error message wouls seem to suggest that, but it's there in the right place,
CFX is registered the same way as all the other java cfx's I run here, all
looks ok to me.

-----Original Message-----
From: Adrian Lynch [mailto:[EMAIL PROTECTED]] 
Sent: 26 September 2002 12:53
To: CF-Talk
Subject: RE: Java custom tag


Could it be it can't find the class you just wrote?

Ade

-----Original Message-----
From: Craig Dudley [mailto:[EMAIL PROTECTED]]
Sent: 26 September 2002 12:35
To: CF-Talk
Subject: Java custom tag


Hi all,

Does any java programmer on here have 5 minutes to look this over for me?

It's basically for sending XML packets via HTTP POST to our SMS provider, it
follows their example but I've converted it into a CF custom tag, but to be
honest JAVA is not my strong point and I can't figure out why it will not
run.

Here's the error message I get...

java.lang.ClassNotFoundException: sendXMLDataToRM.class. Java exception
occurred in call to method.

I'm sure I've come across this error before, but can't remmeber what causes
it. As I say, I'm still a java newbie.

I'm running CF5 enterprise and JVM 1.3.1_04



code start
------------------------------------

import com.allaire.cfx.* ;
import java.io.* ;
import java.net.* ;
import java.util.* ;

public class sendXMLDataToRM implements CustomTag{
   public void processRequest( Request request, Response response ) throws
Exception
   {
  if (  !request.attributeExists("xmlData") ||
!request.attributeExists("Url") )
  {
     throw new Exception( 
        "Missing attribute (xmlData and Url are both required attributes for
this tag)" ) ;
  }
  
  String Url = request.getAttribute("Url") ;      
  String xmlData = request.getAttribute("xmlData");
  String xmlResponse = "";
  
  URL url = new URL( Url );
  
  HttpURLConnection connection = ( HttpURLConnection ) url.openConnection();
 
  connection.setDoOutput( true );
  connection.setDoInput( true );
  connection.setRequestMethod( "POST" );
  connection.setUseCaches( false );
  connection.setRequestProperty( "Content-type",
"application/x-www-form-urlencoded");
 
  String dataString = "XMLDATA=" + URLEncoder.encode(xmlData);
 
  DataOutputStream dos = new DataOutputStream( connection.getOutputStream()
);
 
  dos.writeBytes( dataString );
  dos.flush();
  dos.close();
 
  InputStream is = connection.getInputStream();
  BufferedReader reader = new BufferedReader( new InputStreamReader( is ));
  StringBuffer answer = new StringBuffer();
  String line = null;
 
  while ( ( line = reader.readLine() ) != null ){
  answer.append(line);
  }
 
  is.close();
 
  response.setVariable( xmlResponse, answer.toString());
 }
}

----------------------------------
code stop

TIA, Craig.


______________________________________________________________________
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/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to