Re: NetConnection.Call.Failed

Flávio Lúcio Pereira <[email protected]>
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
I create a directory with a name the pacote inside of 

\webapps\openamf\WEB-INF\classes\org\openamf  and I put the
Centralizador.class and Usuario.class

in my actionscript I put: 

 var servico = gatewayConnection.getService("pacote.Centralizador", this);

I am not knowing to use hierarchy of directories.....

how I must make?

Thanks again!!!

Flávio

2005/9/6, Reza Heidari <[email protected]>:
> It looks like it's not able to find pacote.Centralizador in the openamf web application...Your Centralizador.java is in the pacote package inside of the openamf web application, right?
> 
> - Reza
> 
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Flávio Lúcio Pereira
> Sent: Tuesday, September 06, 2005 1:32 PM
> To: [email protected]
> Subject: Re: [Openamf-user] NetConnection.Call.Failed
> 
> Reza,
> 
> First, I would like to be thankful for its aid.....
> 
> I made the changes that you he ordered....
> 
> the error message now is:
> 
> code:             SERVER.PROCESSING
>  level:             error
>  type:             java.lang.Exception
>  rootcause:     undefined
>  description:    No service for 'pacote.Centralizador'
>  details:          java.lang.Exception: No service for 'pacote.Centralizador'
> 
> you it could continue to help me, please?
> 
> I trust you!! :)
> 
> to follow my actionscript code and, my java code and other are:
> 
> 
> 
> 
> ActionScript Code:
> 
> //Importando a classe Usuario
> import Usuario.as;
> //Classes para a conexão remota...
> //#include "Netservices.as"
> //#include "NetDebug.as"
> import mx.remoting.*;
> //Definindo a Conexão Remota....
> var gatewayUrl:String = "http://localhost:8080/openamf/gateway";
> 
> NetServices.setDefaultGatewayUrl(gatewayUrl);
> 
> var gatewayConnection = NetServices.createGatewayConnection();
> 
> //Definindo o Serviço Java....
> 
> var servico = gatewayConnection.getService("pacote.Centralizador", this);
> 
> 
> //Mapeando as clases.... ( classe java / classe flash )
> 
> var teste = Object.registerClass("Usuario", Usuario);
> 
> 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("  - mandarUsuario - ");
> //Chamando o método mandarUsuario da classe Java definida no serviço
> servico.mandarUsuario(novoUsuario);
> //Definindo a função resultado de mandarUsuario
> function mandarUsuario_Result(result) {
>         trace("Usuario mandado (corretamente): "+result);
>         trace(" ------------------ ");
>         trace(" - receberUsuario - ");
>         //Chamando o metodo receberUsuario da classe Java definida no servico
>         servico.receberUsuario();
> }
> //Definindo a função resultado de receberResultado
> function receberUsuario_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 Usuario.as  is:
> 
> class Usuario
> {
>         var nome:String;
> 
>         function Usuario()
>         {
>                 trace("Novo usuario Flash criado...");
>         }
> 
>         public function toString():String
>         {
>                 return "usuario[" + nome + "]";
>         }
> }
> 
> =============================================================================
> 
> My class java: Centralizador.java
> 
> import java.util.logging.Logger;
> 
> import com.carbonfive.flash.ASTranslator;
> 
> 
> public class Centralizador {
>         private static final Logger log =
> Logger.getLogger(Centralizador.class.getName());
> 
>         private Usuario usuario;
> 
>         public void mandarUsuario(Usuario usuario)
>         {
>                 ASTranslator t = new ASTranslator();
>                 usuario = (Usuario)t.fromActionScript(usuario);
> 
>                 log.info("usuario recolhido: " + usuario.toString());
>         }
>         public Usuario receberUsuario()
>         {
>         //      ASTranslator t = new ASTranslator();
>                 log.info("usuario a enviar: " + usuario.toString());
> 
>                 return usuario;
>         }
> }
> 
> 
> =============================================================================
> 
> 
> my class Usuario.java is:
> 
> 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() + "]";
>         }
> }
> 
> =============================================================================
> 
> my 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>false</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>
> 
>         <custom-class-mapping>
>                <java-class>org.openamf.pacote.Usuario</java-class>
>                <custom-class>Usuario</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-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>
> </web-app>
> 
> 
> -------------------------------------------------------
> 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.