Hi...
I'm using flex. I need to consume web services and EJBs with my flex app, but i 
can´t use a complex data type like a Transfer Object.
i´m trying to use a jar file than contain a proxy of my web service 
nevertheless the flex project does not recognize the jar file.
I have my remoting-config.xml with this code...
 <destination id="invocaClienteWS">
  <properties>
   <source>mx.gob.snsp.ws.consultarepuve.cliente.VinInfoTO</source>
   <scope>application</scope>
  </properties>
 </destination>   
I think, that is not nescesary.
In my path project i have:
...\WEB-INF\lib
  my_file.jar
Is that correct?. What is the correct path for copying that?
if a type 
import
Flex show me 
Definition mx.gob.snsp.ws.consultarepuve.cliente.VinInfoTO could not be 
found.mx.gob.snsp.ws.consultarepuve.cliente.VinInfoTO;
My Transfer Object is like:
import java.io.Serializable;
import java.util.Collection;
public class VinInfoTO  implements Serializable{
    private String vin;
    private String nci;
    private String fechaRegistro;
    private String nomFabricante;
    private String nomDistribuidor;
    private long   folio;
    private Collection movsIntercambio;
    public long getFolio() {
        return folio;
    }
    public void setFolio(long folio) {
        this.folio = folio;
    }
    public String getVin() {
        return vin;
    }
    public String getNci() {
        return nci;
    }
    public String getFechaRegistro() {
        return fechaRegistro;
    }
    public String getNomFabricante() {
        return nomFabricante;
    }
    public String getNomDistribuidor() {
        return nomDistribuidor;
    }
    public Collection getMovsIntercambio() {
        return movsIntercambio;
    }
    public void setVin(String vin) {
        this.vin = vin;
    }
    public void setNci(String nci) {
        this.nci = nci;
    }
    public void setFechaRegistro(String fechaRegistro) {
        this.fechaRegistro = fechaRegistro;
    }
    public void setNomFabricante(String nomFabricante) {
        this.nomFabricante = nomFabricante;
    }
    public void setNomDistribuidor(String nomDistribuidor) {
        this.nomDistribuidor = nomDistribuidor;
    }
    public void setMovsIntercambio(Collection movsIntercambio) {
        this.movsIntercambio = movsIntercambio;
    }
}
what can i do for using a transfer object in flex?
Please help me.



----- Mensaje original ----
De: Mehdi <[EMAIL PROTECTED]>
Para: [email protected]
Enviado: miércoles, 4 de junio, 2008 4:20:19
Asunto: [flexcoders] How to expose Hibernate 'non' conventional beans into flex 
apps via remoting


I am relatively new to the flex world. I am from the Spring/Hibernate
world.
In Hibernate, the POJO object or domain object , or simply beans that
you use to persist you object into the database does not have to
follow the bean definition/contract , i.e: public default constructor
with getter/setters. There are good reasons behind creating those kind
of 'hibernate beans' (I will call them that way for lack of a better
name). In fact, only defining a one-parameter constructor (i.e.
omitting the default one) guaranties you that your client cannot
invoke your API without that needed parameter. Likewise, exposing only
the getters for some private member variables (without the setters)
makes sense when you don't want that variable to ever change,
etc....hibernate manage to access these fields using cglib, and other
tricks.

Now, my understanding of Flex and how remote services work (from what
I could see in all the samples around about hibernate/spring) , is that
your java server bean get proxied 'dynamically' or 'statically' (via
an Actionscript class object) according to the rule: Only "values
found in public bean properties with get/set methods and public
variables " are being copied over to the client proxy object. Which
means that if I dont have a default constructor I am toast. It also
means that my public getVar() (without a setVar()) from my 'hibernate'
bean/POJO will never make it into my client proxy. An example of
getVar(), is simply getdbID(), where the dbID is an
autocincrement/ sequence for example? 

This is creating me tons of problems, because we arlready have a well
rounded/tested server API and we already have a JSF implementation
using it....Re-writing a new one using flex is more something I am
pushing for to prove that we can get better UI,etc....

What is flex/BlazeDS solution for fixing this case?
One solution that comes to mind (not very bright, but should work) is
to build a whole slew of plain java bean objects ( 1 for each of
the'hibernate' bean) to ensure the translation on both side between
the 'hibernate bean' and the 'expected' bean from flex. From the
server to the client, the new bean would copy the content of the
hibernate bean and return that 'proper' beans back to flex. On the way
out (from the client to the server), it would have to recreate the
hibernate bean before feeding it to the API and hibernate).. .. It's
probably not the best solution, especially considering that eventually
as some point, I will need to define another set of those
objects(beans) on the flex side, using actionscript (I think these are
what you guys call VOs) in order to do strong typing in flex........
I must be missing something! can't be that complicated 

Another possible solution (is it? not sure anymore) I believe is to
play with the java/flex Externalizable/ IExternalizable, but that means
changing all my beans on the server (as I will need to implement
Externalizable as per what I understood from the readings).

Isn't there something that I can do on the client only??? How do you
guys handle that?

Any input would be valuable.
Thank you,

 


      
____________________________________________________________________________________
Yahoo! Deportes Beta
¡No te pierdas lo último sobre el torneo clausura 2008! Entérate aquí 
http://deportes.yahoo.com

Reply via email to