Hi! I was checking out an example I found on the web. I installed the application as they instructed. I'm using Tomcat server (v5.5.15) on port 8085. My Flash version is 8 and I installed the remoting components for version 8 AS2.0. But I'm getting the following error after I run the app:
Error opening URL "http://localhost:8085/helloworld/gateway"
Here's the codes:
Code on layer 1:
============
Code:
// ON TIMELINE VERSION //////////////////////////////////////////////
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:8085/helloworld/gateway",
myLogger,
"com.flashdb.services.HelloWorld",
null,
null);
//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" );
}
clearButton.onPress = function(){
show.text = "";
}
stop()
Here's the java code:
Code:
package com.flashdb.services;
public class HelloWorld {
public String makeEcho(String msg){
return msg;
}
}
and Here's the web.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<servlet>
<servlet-name>DefaultGateway</servlet-name>
<display-name>DefaultGateway</display-name>
<description>DefaultGateway</description>
<servlet-class>org.openamf.DefaultGateway</servlet-class>
<init-param>
<param-name>OPENAMF_CONFIG</param-name>
<param-value>/WEB-INF/openamf-config.xml</param-value>
<description>Location of the OpenAMF config file.</description>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>DefaultGateway</servlet-name>
<url-pattern>/gateway</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
I have openamf.jar residing at WEB-INF\lib
Please tell me what's wrong here.