Re: NetConnection.Call.Failed

Flávio Lúcio Pereira <[email protected]>
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
Ok, I´m sorry for that....

Please, Help-me now :)

Thakz for interesting!!!

The log files contains: 

01/09/2005 11:09:16 org.openamf.io.AMFDeserializer <init>
INFO: Deserializing Message, for more info turn on debug level
01/09/2005 11:09:16 org.openamf.DefaultGateway service
INFO: REQUEST:
[AMFBody: {serviceName=org.openamf.examples.Centralizador,
serviceMethodName=mandarUsuario, response=/1, type=ARRAY,
value=[ASObject[type=Usuario]]}]


My JAVA code is: 

Centralizador.java

package pacote;
import java.util.logging.Logger;
import com.carbonfive.flash.ASTranslator;
import flashgateway.io.ASObject;


public class Centralizador {
	private static final Logger log =
Logger.getLogger(Centralizador.class.getName());
	
	private Usuario usuario;
	
	public void sendUser(ASObject usuarioAS)
	{
		ASTranslator t = new ASTranslator();
		usuario = (Usuario)t.fromActionScript(usuarioAS);
		
		log.info("usuario recolhido: " + usuario.toString());
	}
	public ASObject getUser()
	{
		ASTranslator t = new ASTranslator();
		log.info("usuario a enviar: " + usuario.toString());
		
		return (ASObject)t.toActionScript(usuario);
	}
}

----------------------------------------------------------------------------------------------------------------------------------

Other Class - User.java

package pacote;
import java.io.Serializable;

public class Usuario implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String nome;
	
	
	public String getNome(){
		return nome;
	}

	
	public void setNome(String novoNome)
	{
		nome = novoNome;
	}
	
	
	public String toString()
	{
		return "Usuario[" + getNome() + "]";
	}
}

----------------------------------------------------------------------------------------------------------------------------------

ActionScript code: 

//Importando a classe Usuario
import User.as;

//Classes para a conexão remota...
//#include "Netservices.as"
//#include "NetDebug.as"
import mx.remoting.*;


//Definindo a Conexão Remota....

NetServices.setDefaultGatewayUrl("http://localhost:8080/openamf/gateway");

var gatewayConnection = NetServices.createGatewayConnection();

//Definindo o Serviço Java....

var servico = gatewayConnection.getService("org.openamf.examples.Centralizador",
this);



//Map the classes.... ( classe java / classe flash )



var teste = Object.registerClass("User", User);
if(teste == true){
	trace("A classe foi registrada com sucesso!!");	
}else{
	trace("Ocorreu um erro ao registrar a classe!");
	}

//Criando um usuario Flash
var novoUsuario:Usuario = new Usuario();
	novoUsuario.nome = "Flavio";
	trace(novoUsuario.toString());

//Enviando o usuario
trace("--------------------");
trace("  - sendUser - ");
//Chamando o método mandarUsuario da classe Java definida no serviço

servico.sendUser(novoUsuario);

//Definindo a função resultado de mandarUsuario
function sendUser_Result(result)
{
	trace("Usuario mandado (corretamente): " + result);
	
	trace(" ------------------ ");
	trace(" - getUser - ");
	
	//Chamando o metodo receberUsuario da classe Java definida no servico
	servico.receberUsuario();
}
//Definindo a função resultado de receberResultado
function getUser_Result(result)
{
	trace("Usuario Recebido (corretamente): " + result);
	trace("eh uma instancia de Usuario? -> "  + (result instanceof Usuario));
}

//Definindo uma funçao global para o caso de ocorrer um erro

_global.System.onStatus = function(status)
{
	trace(" - onStatus:");
	trace(" codigo:       " + status.code);
	trace(" level:        " + status.level);
	trace(" type:         " + status.type);
	trace(" rootcause:    " + status.rootcause);
	trace(" descricao:    " + status.description);
	trace(" details:      " + status.details);
}

----------------------------------------------------------------------------------------------------------------------------------

Class User.as

class User
{
	var name:String;

	function User()
	{
		trace("Novo usuario Flash criado...");
	}

	public function toString():String
	{
		return "usuario[" + name + "]";
	}
}

----------------------------------------------------------------------------------------------------------------------------------

the contains openamf-config.xml : 


<?xml version="1.0" encoding="UTF-8"?>
<config>

	<!--
	Configure behavior of outgoing AMF messages:
	forceLowerCaseKeys - if true, the hash maps used to return custom classes
	will convert all keys to lower case; 
	set this to:
		true if you're using ActionScript 1.0 on the client,
		false if you're using ActionScript 2.0 (which is case-sensitive)
	-->
	<amf-serializer>
			<force-lower-case-keys>true</force-lower-case-keys>
	</amf-serializer>
       
	<!-- Required for DefaultGateway-->
	<invoker>
		<name>PageableRecordSet</name>
		<class>org.openamf.invoker.PageableResultSetServiceInvoker</class>
	</invoker>
	<invoker>
		<name>SessionControl</name>
		<class>org.openamf.invoker.SessionControlInvoker</class>
	</invoker>
	<invoker>
		<name>WebService</name>
		<class>org.openamf.invoker.WebServiceInvoker</class>
	</invoker>
	<invoker>
		<name>JMX</name>
		<class>org.openamf.invoker.JMXServiceInvoker</class>
	</invoker>
	
	<!-- Uncomment this to enable EJB invoker
	<invoker>
		<name>EJB</name>
		<class>org.openamf.invoker.EJBServiceInvoker</class>
	</invoker>
	-->
	
	<invoker>
		<name>Java</name>
		<class>org.openamf.invoker.JavaServiceInvoker</class>
	</invoker>
	<pageable-recordset>
		<initial-data-row-count>20</initial-data-row-count>
	</pageable-recordset>
	<!-- 
	Example Custom Class to Java Class mapping
	
	When a class of type org.openamf.examples.Person is Serialized
	it will be registered to Person in flash 
	
	When a custom class of Person is Deserialized it
	will be translated to an org.openamf.examples.Person
	
	<custom-class-mapping>
		<java-class>org.openamf.examples.Person</java-class>
		<custom-class>Person</custom-class>
	</custom-class-mapping>
	-->
	<!-- Required  for AdvancedGateway -->
	<!-- 
		This allows you to declare infomation about your services,
		instead of having the DefaultGateway guess 
	-->
	<service>
		<name>SessionControlService</name>
		<invoker-ref>SessionControl</invoker-ref>
		<method>
			<name>close</name>
			<parameter>
				<type>*</type>
			</parameter>
		</method>
	</service>
	<service>
		<name>OpenAMFPageableRecordSet</name>
		<invoker-ref>PageableRecordSet</invoker-ref>
		<method>
			<name>*</name>
			<parameter>
				<type>*</type>
			</parameter>
		</method>
	</service>
	<service>
		<name>Directory</name>
		<service-location>org.openamf.examples.Directory</service-location>
		<invoker-ref>Java</invoker-ref>
		<method>
			<!-- Operation's are matched by the name and parameters -->
			<name>addPerson</name>
			<state-bean-ref>
				<name>Authentication</name>
			</state-bean-ref>
			<parameter>
				<!-- 
					type can be the the name of the class, 
					a * for any types,
					or a ? any 1 type
				-->
				<type>*</type>
			</parameter>
		</method>
		<method>
			<!-- Operation's are matched by the name and parameters -->
			<name>getPeople</name>
			<state-bean-ref>
				<name>Authentication</name>
			</state-bean-ref>
			<parameter>
				<!-- 
					type can be the the name of the class, 
					a * for any types,
					or a ? any 1 type
				-->
				<type>*</type>
			</parameter>
			<result-filter>
				<class>org.openamf.filter.BeanListToRecordSet</class>
				<parameter>
					<name>ignore</name>
					<value>extraInfo</value>
				</parameter>
			</result-filter>
		</method>
	</service>
	<state-bean>
		<name>Authentication</name>
		<class>org.openamf.examples.Authentication</class>
		<scope>session</scope>
	</state-bean>
</config>

---------------------------------------------------------------------------------------------------------------------------------

my web.xml is: 

<?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>
		<servlet-name>AdvancedGateway</servlet-name>
		<display-name>AdvancedGateway</display-name>
		<description>AdvancedGateway</description>
		<servlet-class>org.openamf.AdvancedGateway</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>
    <servlet-name>ServletRedirector</servlet-name>
    <servlet-class>org.apache.cactus.server.ServletTestRedirector</servlet-class>
  </servlet>
	<servlet-mapping>
		<servlet-name>DefaultGateway</servlet-name>
		<url-pattern>/gateway</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>AdvancedGateway</servlet-name>
		<url-pattern>/gateway2</url-pattern>
	</servlet-mapping>
  <servlet-mapping>
    <servlet-name>ServletRedirector</servlet-name>
    <url-pattern>/ServletRedirector</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>





2005/8/31, Todd Hivnor <[email protected]>:
> There isn't enough information in your error report for us to really help.
> We need more clues.
> 
> Have you configured logging?
> What is in your log files?
> 
> You might want to attach your Java code, ActionScript code, web.xml, and
> openamf-config.xml files.
> 
> 
> 
> Flávio Lúcio Pereira wrote:
> 
> >Please I am despaired.
> >
> >I do not obtain to correct this error.....
> >
> >- onStatus:
> >  code:       NetConnection.Call.Failed
> >  level:          error
> >  type:          undefined
> >  rootcause:  undefined
> >  description:   HTTP: Status 500
> >  details:       http://localhost:8080/openamf/gateway
> >
> >Somebody could help me?
> >
> >I would be thankful much!!!
> >
> >Flávio
> >
> >
> >-------------------------------------------------------
> >SF.Net email is Sponsored by the Better Software Conference & EXPO
> >September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> >Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> >Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> >_______________________________________________
> >Openamf-user mailing list
> >[email protected]
> >https://lists.sourceforge.net/lists/listinfo/openamf-user
> >
> >
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Openamf-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user
>


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.