1. It's the name of the cfc (ex. javacall.cfc). 2. Yes. 3. String sendTo = "[email protected]"; String sendFrom = "[email protected]"; String messageBody = "A test message"; Object[] myArgs = {sendTo, sendFrom, messageBody}; 4. I'm not understanding your question. A CFC can generate output that normally goes to a browser and can return results. The generated output would go to the passed in java.io.Writer while the results would be returned from the invoke() method call. 5. getData is actually the name of the function in the javacall.cfc that is being called. If C:\myCFCs is in the custom tag path and javacall.cfc was in C:\myCFCs\test\javacall.cfc then you would pass test.javacall to CFCProxy instead of just javacall.
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of BD_Architect Sent: Friday, November 13, 2009 12:10 AM To: Open BlueDragon Subject: [OpenBD] Re: Execute CFC from Java Excellent and thanks for the quick response! New to java so please bare with me. Question: ------------- 1. What is javacall / its purpose? 2. Would I have to import the com.newatlanta.cfc.CFCProxy or java.util.Map or java.io.Writer at the top of the .java file? 3. In [Object[] myArgs = {"Java invocation working"};], where you have "Java invocation working", could you provide a sample syntax of real data/object I would put in there if my cfc was expecting say 3 strings like sendTo, sendFrom & messageBody? 4. If a CFC does pass back a response, I could then access the response by the myCFC object correct? 5. I can see that in the example that getData is the called CFC. How do you reference a path to the CFC if it is not in the same directory? On Nov 12, 11:05 pm, Paul Bonfanti <[email protected]> wrote: > Yes you can invoke a cfc from a servlet using the following syntax. Note that > request is the servlet request object, response is the servlet response > object, and out is a java.io.Writer where the output from the cfc is written. > The invoke() method returns an object so you'll need to cast it to the type > returned by the cfc. In the case below the cfc is returning a java.util.Map > object. > > com.newatlanta.cfc.CFCProxy myCFC = new > com.newatlanta.cfc.CFCProxy("javacall", request, response, out); > Object[] myArgs = {"Java invocation working"}; > java.util.Map map = (java.util.Map)myCFC.invoke("getData", myArgs); > > If the cfc doesn't generate any output then you don't need to pass a > java.io.Writer as shown below: > > com.newatlanta.cfc.CFCProxy myCFC = new > com.newatlanta.cfc.CFCProxy("javacall", request, response); > Object[] myArgs = {"Java invocation working"}; > java.util.Map map = (java.util.Map)myCFC.invoke("getData", myArgs); > > Paul > > -----Original Message----- > From: [email protected] [mailto:[email protected]] On Behalf Of > BD_Architect > Sent: Thursday, November 12, 2009 10:45 PM > To: Open BlueDragon > Subject: [OpenBD] Execute CFC from Java > > Is there a simple way to invoke a cfc from a java file? I see that > there is a CFCProxy for adobe, is this (or similar) also available in > openBD. > > --~--~---------~--~----~------------~-------~--~----~ Open BlueDragon Public Mailing List http://groups.google.com/group/openbd?hl=en official site @ http://www.openbluedragon.org/ !! save a network - trim replies before posting !! -~----------~----~----~----~------~----~------~--~---
