newbie questions - desparate need of help!!!
"[p e r c e p t i c o n]" <[email protected]> Fri, 19 Jan 2007 16:05:03 -0800
| Newsgroups | gmane.comp.java.openamf.user |
|---|---|
| Message-ID | <[email protected]> |
Hi all
i'm having some difficulty making flash remoting work. I tried the "Hello
World" example from the OPENAMF examples to no avail and can't seem to
invoke any method other than doPost...which is fine if you can tell me how
to send a response back to the client (swf) i called it from. I noticed
while debugging my swf that the content-type is application/x-fcs and my
responder is null until pending call sets it to _level0. is there a way to
change this content-type to something else and if so what should it be?
I'll list my code and configuration below. is there an easier way to do
this? should i not use a servlet??
config
borland jbuilder 2005
tomcat 5.0.27
jdk 1.4.2
Flash8
here's my actionscript code
import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
mx.remoting.debug.NetDebug.initialize(); // initialize the NetConnection
Debugger
var myLogger:Log = new Log( Log.DEBUG, "logger1" );
// override the default log handler
myLogger.onLog = function( message:String ):Void {
trace( "myLogger-->>>"+message );
}
//Create the service ->based on back-end used, comment/uncoment following
arguments
myService = new Service( "http://localhost:8083/WebModule1/", myLogger,"
simpleservlet.servlet1", null,this);
//Handler for results
function onEchoData(msg: ResultEvent){
mx.remoting.debug.NetDebug.trace({level:"Debug", message:"onEchoData"
});
show.text = msg.result;
}
//Handler for errors
function onEchoFault(rs: FaultEvent ){
mx.remoting.debug.NetDebug.trace({level:"None", message:"There was a
problem: " + fault.fault.faultstring });
}
//Buttons handlers
callButton.onPress = function(){
var pc:PendingCall = myService.makeEcho("Hello World!");
pc.responder = new RelayResponder(this._parent, "onEchoData",
"onEchoFault" );
trace("calling makeEcho");
}
and here's the java code
package simpleservlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import org.apache.commons.io.*;
import org.apache.commons.fileupload.*;
import org.apache.commons.fileupload.disk.*;
import org.apache.commons.fileupload.servlet.*;
import magick.DrawInfo;
import magick.MagickImage;
import magick.PixelPacket;
import magick.ImageInfo;
import magick.MagickException;
import flashgateway.io.ASObject;
import org.openamf.*;
import com.carbonfive.flash.ASTranslator;
public class Servlet1
extends HttpServlet {
private String dirName;
private String fullPath;
private String message = null;
public Servlet1() {
try {
jbInit();
System.out.println("ctor sucess");
}
catch (Exception ex) {
ex.printStackTrace();
System.out.println("ctor failure");
}
}
private static final String CONTENT_TYPE = "text/html";
//Initialize global variables
int connections = 0;
public void init() throws ServletException {
System.out.println("init");
message = "Hello from servlet1";
}
public String makeEcho(String msg)
{
return msg;
}
//Process the HTTP Get request
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws
ServletException, IOException {
//Name of User
String userName = request.getParameter("UserName");
if (userName == null) {
userName = "User!";
}
}
//Process the HTTP Post request
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws
ServletException, IOException
{
}
//Clean up resources
public void destroy() {
message = null;
}
public String getServletInfo()
{
return "A test servlet.";
}
public ServletConfig getServletConfig()
{
return null;
}
private void jbInit() throws Exception {
}
}
thanks in advance
p
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Openamf-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openamf-user