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.
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.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