Welcome, Guest
  • Author Topic: flash remoting using xml  (Read 3400 times)

    aceone

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    flash remoting using xml
    « on: 01/03/08, 18:23 »
    hi
    i need example for transferring data from java to flash using an xml file (the xml file needs to be created with java)
    i'm using eclipse (jdom for xml stuff)
    flash cs3
    openamf (for flash remoting)
    thnx

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: flash remoting using xml
    « Reply #1 on: 01/04/08, 03:01 »
    Is this XML file externaly generated?
    Then just transfer it as text stream (XML is nothing but text).
    Else - why XML an remoting?
    You can transfer complex structures and objects more direct without XML overhead by just using AMF
    happy flashing
    8)
    Ronald

    aceone

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Re: flash remoting using xml
    « Reply #2 on: 01/04/08, 10:35 »
    hi again i create this class:
    Code: [Select]
    import java.io.*;
    import org.jdom.*;
    import org.jdom.output.*;
    public class HelloWorld
    {
    static Element racine = new Element("personnes");
    static org.jdom.Document document = new Document(racine);
    public static void main(String[] args)
    {
    Element etudiant = new Element("etudiant");
    racine.addContent(etudiant);
    Attribute classe = new Attribute("classe","P2");
    etudiant.setAttribute(classe);
    Element nom = new Element("nom");
    nom.setText("CynO");
    etudiant.addContent(nom);
    affiche();
    enregistre("Exercice1.xml");
    }
    public static void affiche()
    {
    try
    {
    XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
    sortie.output(document, System.out);
    }
    catch (java.io.IOException e){}
    }
    public static void enregistre(String fichier)
    {
    try
    {
    XMLOutputter sortie = new XMLOutputter(Format.getPrettyFormat());
    sortie.output(document, new FileOutputStream(fichier));
    }

    catch (java.io.IOException e){}
    }
    }

    i want to invok with flash  the "enregistre" method to save the xml file created by my class

    Ronald Wernecke

    • Global Moderator
    • Systems Administrator
    • *****
    • Posts: 6203
      • View Profile
      • Professional Support
      • Email
    Re: flash remoting using xml
    « Reply #3 on: 01/04/08, 14:05 »
    this looks like, you have used the hello world service class to do your service.
    This is ok, but confuses a little.

    Just call the hello world service with the methode enregistre

    If you are not sure what happens, or want to watch whats going on, use charles to check the transport, and use the browser service to check, if your service is running ok.

    I will not analyse your service code ;)
    happy flashing
    8)
    Ronald

    aceone

    • Server what's that
    • *
    • Posts: 3
      • View Profile
      • Email
    Re: flash remoting using xml
    « Reply #4 on: 01/04/08, 17:20 »
    hi again
    i get this:
    Code: [Select]
    myLogger-->>>1/4 23:16:56 [INFO] logger1: Creating Service for com.flashdb.services.HelloWorld
    myLogger-->>>1/4 23:16:56 [INFO] logger1: Creating gateway connection for http://localhost:8080/helloworld/gateway
    myLogger-->>>1/4 23:16:56 [INFO] logger1: Successfully created Service
    myLogger-->>>1/4 23:16:59 [INFO] logger1: Invoking enregistre on com.flashdb.services.HelloWorld
    myLogger-->>>1/4 23:16:59 [DEBUG] logger1: Service invocation failed.
    myLogger-->>>1/4 23:16:59 [DEBUG] logger1: com.flashdb.services.HelloWorld.enregistre() returned []

    idon't know how what parameter i should put for enregistre methods in actions script.