Can i return an Array of Objects from c++ to java ??

hello all,
Can i return an Array of Objects from c++ to java ??
If so how is it possible ??
regards,
gautam

I suggest you look into the JNI, Java Native Interface. The answer is yes.

Similar Messages

  • Is it possible to return an array of objects from a web service?

    I have been trying to do this for a while now, and I have come to the conclusion that it may be impossible. To demonstate what I want to do I enclose a simple java file [1]. I have deployed this with Axis 2 and I enclose the responce [2], it is obciously not wat I want.
    Is it porrible to do this? If so, how?
    Thanks for any help,
    [1]
    package org.impress;
    public class SampleObject {
         public SampleElement[] noParameters(){
              SampleElement[] retArray = new SampleElement[2];
              retArray[0] = new SampleElement();
              retArray[0].name = "one";
              retArray[0].value = "alpha";
              retArray[1] = new SampleElement();
              retArray[1].name = "two";
              retArray[1].value = "beta";
              return retArray;
         public class SampleElement {
              public String name;
              public String value;
    }[2]
    <ns:noParametersResponse>
         <ns:return type="org.impress.SampleObject$SampleElement"/>
         <ns:return type="org.impress.SampleObject$SampleElement"/>
    </ns:noParametersResponse>

    Hi
    Can anybody help me with the code of how to return a resultset from a web service. i have put the resultset data's in an object array and tried to return it, but in the client side no data comes ,,, i mean it is printed as null.... and plz tell me where to specify the return type of a object in the wsdl file....
    thanks..

  • Can we return a Array of varchar2 from a function ?

    Hello,
    i have a sql query that returns some rows. I want to define that query inside a function and want to retrieve the results in an array .Finally i want to retrieve those values in array in my .NET runtime . How can i achieve this ?

    bootstrap wrote:
    CREATE OR REPLACE function f_func(dept varchar2) return (what will be return type here ?)As Tubs said - ref cursor.
    Any other choice is likely very wrong.
    select statement...returning a resultset containing more than one rows..Cursors are not result sets. Cursors are not result sets. Repeat this over and over again.
    A cursor is a program. The results from it is the output of the program. There is no so-called result set created in memory containing the output of that cursor.
    The flaw in your approach is to fetch the output of this program, and storing it in very expensive server memory (called the PGA in Oracle) - for returning data as a primitive non-scalar data structure to the client.
    Returning a ref cursor (aka a pointer to a cursor) means that you give the client direct access to the interface of that cursor program. Allowing the client to directly fetch and consume the output of that program. Enabling the client to deal with the standard SQL (cursor) interface.
    A significantly more performant and scalable method than to create a primitive result set cache in server memory for the output and then shipping that (as a non-standard data structure) to a client.
    A ref cursor interface can returns millions of rows and GBs of data. How many rows do you think this approach of yours will take? How many clients can call that same PL/SQL interface of yours at the same time, before the memory footprint of caching SQL data in the PGA for external clients exceeds free server memory?
    Do you realise what happens next? Swap daemons trashing badly consuming most of the CPU (even starving the kernel itself). If you're lucky, the server will crash quickly. If not, even console access to the server in attempt to fix mess will be something like typing one character every 60 seconds at the console.

  • Return array of varchar from oracle to java

    Hi,
    I am trying to return an array of varchar from database to java. However, when I print the values in java, it prints hexadecimal values like this.
    0x656E7472792031
    0x656E7472792032
    0x656E7472792033
    0x656E7472792034
    I am using oracle 9.2.0.5.0 and jdk 1.4
    This happens only when the NLS character set of the database is WE8MSWIN1252 (default character set).
    It works fine on databases with UTF8 and US7ASCII character sets.
    Any leads to the reason behind this behaviour is greatly aprpeciated.
    Here's the code snippet...
    <code>
    //USER DEFINED TYPE
    create or replace type SimpleArray
     as table of varchar2(30)
    </code>
    <code>
    // FUNCTION RETURNING USER DEFINED TYPE
    create or replace function getSimpleArray return SimpleArray
     as
     l_data simpleArray := simpleArray();
     begin
      for i in 1 .. 10 loop
          l_data.extend;
          l_data(l_data.count) := 'entry ' || i;
        end loop;
        return l_data;
      end;
    </code>
    <code>
    // JAVA METHOD
    public static void main(String[] args)
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:@localhost:1521:db1252";
              Connection conn = DriverManager.getConnection(url, "ring", "ring");
              CallableStatement stmt = conn.prepareCall("{? = call "
                             + "getSimpleArray" + "}");
              Array rs = null;
              ResultSet rsltSet = null;
              stmt.registerOutParameter(1, Types.ARRAY, "SIMPLEARRAY");
              stmt.execute();
              rs = stmt.getArray(1);
              String[] values = (String[]) rs.getArray();
              System.out.println(rs.getBaseTypeName());
              System.out.println(values.length);
              for (int i = 0; i < values.length; i++) {
                   System.out.println(values);
              rsltSet = rs.getResultSet();
         } catch (Exception e) {
              System.err.println("Got an exception! ");
              System.err.println(e.getMessage());
    </code>
    Thanks,
    Vivek

    Actually, check nls_charset12.zip. It looks like 9.2.0.5 driver contains only the *.zip version. Make sure that the file exists in the directory pointed by the CLASSPATH. Use full path, do not use %ORACLE_HOME%.
    I have reproduced your problem without nls_charset12.zip and I could not reproduce it with the file in the class path. Double-check how classpath is set in your environment. Maybe it is overriden by some configuration or batch file.
    -- Sergiusz

  • Pass an ArrayList of objects from C++ to JAVA using JNI

    Hello,
    I need to get the running Windows processes using C++ and have a Process struct in C++ having 2 fields: name and pid. I want to pass an ArrayList of Process from C++ to Java. I have found an example of how to pass an array of objects from C++ to Java, but I'd like to pass an ArrayList, and I was wondering if this is possible, before understanding that example and use an array.
    I don't have much experience with C++ and I don't even know if you have something like an ArrayList in C++, so I'm sorry if it doesn't make any sense what I'm talking about. Thank you.

    From C you can access and/or imnstantiate one of the
    java collections. In other words, your C code should
    simply populate java structures and a collection.I have read this is possible after I posted this, but didn't find an example yet. I began reading "Java Native Interface" book from Addison-Wesley today to get a better understanding of JNI.
    If you know where to find an example of doing this, I would appreciate it. Otherwise, I suppose I will find this in the above mentioned book quite soon... Thank you.

  • Oracle ADF Mobile getting array of objects from webservice

    hi,
    i am trying to fetch a certain number of records using a webservice call and then storing in the SQLLite DB in the mobile.
    i understand i can create a data control using the webservice > then?
    my webservice returns an array of objects.
    how can i do that?
    regards,
    ad

    It's fairly easy.
    What I have done is created a WebService Controller (plain java class) which calls the methods (from the WS) programmaticly.
    Example :
    public class WSController {
        private final String WSDataControllerName = "ThisIsTheNameOfMyWebserviceDataControl";
        private List pnames ,ptypes ,params;
        public WSController() {
            super();
        public List getAllActioncodesFromWS()
           //start - WS empty params
            pnames = new ArrayList();
            params = new ArrayList();
            ptypes = new ArrayList();
            pnames.add("findCriteria");
            params.add(null);
            ptypes.add(Object.class);
            pnames.add("findControl");
            params.add(null);
            ptypes.add(Object.class);
            //end - WS empty params
            List actionCodes = new ArrayList();
            try
                GenericType result = (GenericType)AdfmfJavaUtilities.invokeDataControlMethod(WSDataControllerName, null, "findActioncodesView1",pnames, params, ptypes);
                if(result!=null)
                    for (int i = 0; i < result.getAttributeCount(); i++)
                        GenericType row = (GenericType)result.getAttribute(i);
                        Actioncode wd = (Actioncode)GenericTypeBeanSerializationHelper.fromGenericType(Actioncode.class, row);
                        actionCodes.add(wd);
            catch (AdfInvocationException e)
                e.getMessage();
            catch (Exception e)
                e.getMessage();
         return actionCodes;
        }I also defined a Pojo named Actioncode :
    Note that the attribute names are completly the same as the VO from the web service.
    public class Actioncode {
        String Actioncode,Descript1;
        public Actioncode() {
            super();
        public Actioncode(String Actioncode, String Descript1) {
            super();
            this.Actioncode = Actioncode;
            this.Descript1 = Descript1;
        public void setActioncode(String Actioncode) {
            this.Actioncode = Actioncode;
        public String getActioncode() {
            return Actioncode;
        public void setDescript1(String Descript1) {
            this.Descript1 = Descript1;
        public String getDescript1() {
            return Descript1;
    }Since the WS method returns a GenericType, you can 'convert' that object to an POJO.
    Read more about it here :
    http://adf4beginners.blogspot.be/2013/01/adf-mobile-how-to-iterate-over-all-rows.html
    I know the blog post is about iterating over rows in an iterator, but it's just to illustrate how you can work with the GenericType

  • Deserialize an array of objects from a web service

    Hi, I'm calling a webservice method which returns an array of
    objects (let's
    say classes called MyClass).
    I now want to define a class in actionscript called MyClass
    which matches
    the properties of the class defined in the web service
    (written in .NET),
    call the webservice method, and then deserialize the result
    in actionscript
    into an array of type MyClass.
    The code I have so far is:
    import mx.services.WebService;
    import mx.services.Log;
    var mylog:Log = new Log(Log.DEBUG);
    myLog.onLog = function(txt) {
    trace(txt);
    var ws:WebService = new WebService(wsc.WSDLURL);
    ws.onLoad = function(wsdl) {
    MyPendingCallObject =
    ws.CallTheWebServiceMethodWhichReturnsAnArrayOfMyClasses();
    MyPendingCallObject.onResult = function(result)
    trace(result);
    // HOW CAN I DESERIALIZE the result parameter into an Array
    of
    MyClass ???
    MyPendingCallObject.onFault = function(fault)
    trace('FAULT! ' + fault.faultCode + "," +
    fault.faultstring);
    // If the WSDL fails to load the onFault event is fired.
    ws.onFault = function(fault) {
    trace(fault.faultstring);
    TIA

    Hi,
    I posted a similar problem some time ago :
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=294&threadid =1221565&enterthread=y
    Do you find any solution to your problem ?
    Fabrice

  • Creating an arrays of objects from a class

    I was wondering does any one know how to create an array of objects from a class?
    I am trying to create an array of objects of a class.
    class name ---> Class objectArray[100] = new Class;
    I cant seem to make a single class but i need to figure out how to create an array of objects.
    I can make a normal class with Class object = new Class

    There are four lines of code in your for-loop that actually do something:
    for(index = 0; index < rooms.length; index++) {
    /*1*/  assignWidth.setWidth(Double.parseDouble(in.readLine()));
    /*2*/  rooms[index] = assignWidth;
    /*3*/  assignLength.setWidth(Double.parseDouble(in.readLine());
    /*4*/  rooms[index] = assignLength;
    }1.) Sets the width of an object, that has been instantiated outside the loop.
    2.) assigns that object to the current position in the array
    3.) Sets the width of a second object that has been instantiated outside the loop
    4.) assigns that other object to the current position in the array
    btw.: I bet you meant "assignLength.setLength(Double.parseDouble(in.readLine());" in line 3 ;)
    Since each position in an array can only hold one value, the first assignment (line 2) is overwritten by the second assignment (line 4)
    When I said "construct a new room-object and assign it to rooms[index]" I meant something like this:
    for(index = 0; index < rooms.length; index++) {
        Room aNewRoom = new Room();
        aNewRoom.setWidth(Double.parseDouble(in.readLine()));
        aNewRoom.setLength(Double.parseDouble(in.readLine());
        rooms[index] = aNewRoom;
    }1.) Constructs a new Object in every iteration of the for-loop. (btw: I don't know what kind of objects you're using, so this needs most likely modification!!)
    2.) set the width of the newly created object
    3.) set the length of the newly created object
    4.) assign the newly created object to the current position in the array
    -T-
    btw. this would do the same:
    for(index = 0; index < rooms.length; index++) {
        rooms[index] = new Room();
        rooms[index].setWidth(Double.parseDouble(in.readLine()));
        rooms[index].setLength(Double.parseDouble(in.readLine());
    }but be sure you understand it. Your teacher most likely wants you to explain it ;)

  • How can I fill a table of objects from cursor with select * bulk collect???

    Hi All, I have a TYPE as OBJECT
    create or replace type dept2_o as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    I can fill a table of objects from cursor with out select * bulk collect...., row by row
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    i integer;
    begin
    i:=0;
    dept_o_tab.extend(20);
    for rec in (select * from dept) loop
    i:=i+1;
    dept_o_tab(i):=dept2_o(
    deptno => rec.deptno,
    dname => rec.dname,
    loc =>rec.loc
    end loop;
    for k IN 1..i loop
    dbms_output.put_line(dept_o_tab(k).deptno||' '||dept_o_tab(k).dname||' '||dept_o_tab(k).loc);
    end loop;
    end;
    RESULT
    10 ACCOUNTING NEW YORK
    20 RESEARCH DALLAS
    30 SALES CHICAGO
    40 OPERATIONS BOSTON
    But I can't fill a table of objects from cursor with select * bulk collect construction ...
    declare
    TYPE dept2_t IS TABLE of dept2_o;
    dept_o_tab dept2_t:=dept2_t();
    begin
    dept_o_tab.extend(20);
    select * bulk collect into dept_o_tab from dept;
    end;
    RESULT
    ORA-06550: line 6, column 39;
    PL/SQL: ORA-00947: not enough values ....
    How can I fill a table of objects from cursor with select * bulk collect???

    create or replace type dept_ot as object (
    deptno NUMBER(2),
    dname VARCHAR2(14),
    loc VARCHAR2(13));
    create table dept
    (deptno number
    ,dname varchar2(14)
    ,loc varchar2(13)
    insert into dept values (10, 'x', 'xx');
    insert into dept values (20, 'y', 'yy');
    insert into dept values (30, 'z', 'zz');
    select dept_ot (deptno, dname, loc)
      from dept
    create type dept_nt is table of dept_ot
    declare
       l_depts dept_nt;
    begin
       select dept_ot (deptno, dname, loc)
         bulk collect
         into l_depts
         from dept
       for i in l_depts.first .. l_depts.last
       loop
          dbms_output.put_line (l_depts(i).deptno);
          dbms_output.put_line (l_depts(i).dname);
          dbms_output.put_line (l_depts(i).loc);    
       end loop;
    end;
    /

  • Problem with return a ColdFusion query object from a Java class

    Hi!
    I need to return a ColdFusion query object from a Java class
    using a JDBC result set ( java.sql.ResultSet);
    I have tried to pass my JDBC result set in to the constructor
    of the coldfusion.sql.QueryTable class with this code:
    ColdFusion code
    <cfset pra = createObject("java","QueryUtil").init()>
    <cfset newQuery = CreateObject("java",
    "coldfusion.sql.QueryTable")>
    <cfset newQuery.init( pra.getColdFusionQuery () ) >
    My java class execute a query to db and return QueryTable
    Java code (QueryUtil.java)
    import coldfusion.sql.QueryTable; // (CFusion.jar for class
    QueryTable)
    import com.allaire.cfx //(cfx.jar for class Query used from
    QueryTable)
    public class QueryUtil
    public static coldfusion.sql.QueryTable
    getColdFusionQuery(java.sql.ResultSet rs)
    return new coldfusion.sql.QueryTable(rs);
    but when i run cfm page and coldfusion server tries to
    execute : "<cfset pra =
    createObject("java","QueryUtil").init()>" this error appears:
    Object Instantiation Exception.
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    If i try to execute QueryUtil.java with Eclipse all it works.
    Also I have tried to return java.sql.ResultSet directly to
    coldfusion.sql.QueryTable.init () with failure.
    Do you know some other solution?

    ok
    i print all my code
    pratica.java execute a query to db and return a querytable
    java class
    import java.util.*;
    import java.sql.*;
    import coldfusion.sql.*;
    public class Pratica {
    private HashMap my;
    private String URI,LOGIN,PWD,DRIVER;
    private Connection conn=null;
    //funzione init
    //riceve due strutture converite in hashmap
    // globals
    // dbprop
    public Pratica(HashMap globals,HashMap dbprop) {
    my = new HashMap();
    my.put("GLOBALS",globals);
    my.put("DBPROP",dbprop);
    URI = "jdbc:sqlserver://it-bra-s0016;databaseName=nmobl";
    LOGIN = "usr_dev";
    PWD = "developer";
    DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    try{
    // Carico il driver JDBC per la connessione con il database
    MySQL
    Class.forName(DRIVER);
    /* Connessione alla base di dati */
    conn=DriverManager.getConnection(URI,LOGIN,PWD);
    if(conn!=null) System.out.println("Connection Successful!");
    } catch (ClassNotFoundException e) {
    // Could not find the database driver
    System.out.print("\ndriver non trovato "+e.getMessage());
    System.out.flush();
    catch (SQLException e) {
    // Could not connect to the database
    System.out.print("\nConnessione fallita "+e.getMessage());
    System.out.flush();
    //funzione search
    //riceve un hash map con i filtri di ricerca
    public QueryTable search(/*HashMap arg*/) {
    ResultSet rs=null;
    Statement stmt=null;
    QueryTable ret=null;
    String query="SELECT * FROM TAN100pratiche";
    try{
    stmt = conn.createStatement();// Creo lo Statement per
    l'esecuzione della query
    rs=stmt.executeQuery(query);
    // while (rs.next()) {
    // System.out.println(rs.getString("descrizione"));
    catch (Exception e) {
    e.printStackTrace();
    try {
    ret = Pratica.RsToQueryTable(rs);
    } catch (SQLException e) {
    e.printStackTrace();
    this.close();
    return(ret);
    // ret=this.RsToQuery(rs);
    // this.close(); //chiude le connessioni,recordset e
    statament
    //retstruct CF vede HashMap come struct
    //METODO DI TEST
    public HashMap retstruct(){
    return(my);
    //conversione resultset to querytable
    private static QueryTable RsToQueryTable(ResultSet rs)
    throws SQLException{
    return new QueryTable(rs);
    //chiura resultset statament e connessione
    private void close(){
    try{
    conn.close();
    conn=null;
    catch (Exception e) {
    e.printStackTrace();
    coldfusion code
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    Transitional//EN">
    <html>
    <head>
    <title>Test JDBC CFML Using CFScript</title>
    </head>
    <body>
    <cftry>
    <cfset glb_map =
    createObject("java","java.util.HashMap")>
    <cfset dbprop_map =
    createObject("java","java.util.HashMap")>
    <cfset glb_map.init(glb)> <!---are passed from
    another page--->
    <cfset dbprop_map.init(glb["DBPROP"])>
    <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    <cfset ourQuery
    =createObject("java","coldfusion.sql.QueryTable").init(pra.search())>
    <cfcatch>
    <h2>Error - info below</h2>
    <cfdump var="#cfcatch#"><cfabort>
    </cfcatch>
    </cftry>
    <h2>Success - statement dumped below</h2>
    <cfdump var="#ourQuery#">
    </body>
    </html>
    error at line <cfset pra =
    createObject("java","Pratica").init(glb_map,dbprop_map)>
    An exception occurred when instantiating a java object. The
    cause of this exception was that: coldfusion/sql/QueryTable.
    -----------------------------------------------------------------------

  • How can I return my iPhone4 to OS6 from OS7?

    How can I return my iPhone4 to OS6 from OS7?

    Several people on this discussion board have bought old phones that had not yet been updated and sold their updated phones.

  • Reading an Array of Objects from a .bin file!

    Hey, at the moment I'm creating a program whereby I write a set of objects onto a bin file, in this case an array of objects with a String name/county, and int population/area.... I'm not trying to read it back from the bin file and encountering trouble! I've managed to get it working using plain objects, however I want to be able to read in arrays of objects. The file itself compiles, however during running I get this error
    java.lang.NullPointerException
    at RecordFiles.CoastalRead.main(CoastalRead.java:33)
    at RecordFiles.__SHELL16.run(__SHELL16.java:6)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at bluej.runtime.ExecServer$3.run(ExecServer.java:774)
    Here is the program itself,
    import java.io.*;
    public class CoastalRead {
        public static void main(String[] args) {
            CoastalTowns towns[] = new CoastalTowns[50];
              towns[0] = new CoastalTowns();
              towns[1] = new CoastalTowns();
              towns[2] = new CoastalTowns();
              towns[3] = new CoastalTowns();
              towns[4] = new CoastalTowns();
              String name, county;
              int population, area;
            try {
                FileInputStream fileIn =
                        new FileInputStream("CoastalTownsBin.bin");
                ObjectInputStream in = new ObjectInputStream(fileIn);
                for (int i = 0; i < towns.length; i++){
                 towns[i] =(CoastalTowns) in.readObject();
                   System.out.println("Deserialized File...");
                       System.out.println("Name: " + towns.name);
              System.out.println("County: " + towns[i].county);
         System.out.println("Population: " + towns[i].population);
              System.out.println("Area: " + towns[i].area);
    in.close();
    fileIn.close();
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}
    +I'd appreciate a fast reply!+ And if someone needs the writing class I've used, I can post it asap.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    CoastalTowns towns[] = new CoastalTowns[50];
    towns[0] = new CoastalTowns();
    towns[1] = new CoastalTowns();
    towns[2] = new CoastalTowns();
    towns[3] = new CoastalTowns();
    towns[4] = new CoastalTowns();Why create an array with a size of 50 and then only fill 5 elements?
    Why bother filling any elements at all when you are reading the objects from a file?
    What happens if there are less than 50 objects in your file?
    I will assume CoastalTowns holds info about a single town, so why is it pluralised? Do you have a class called Dog or Dogs, Chair or Chairs, Person or People?
    } catch (IOException i) {}
    catch (ClassNotFoundException c) {}DO NOT swallow exceptions. At the very least put in a call to printStackTrace so you know if/when an exception occurs.
    I'd appreciate a fast reply!I typed as fast as I could but unfortunately I'm still and hunt and peck guy.

  • Formatted .data file, reading in and creating an array of objects from data

    Hi there, I have written a text file with the following format;
    List of random personal data: length 100
    1 : Atg : Age 27 : Income 70000
    2 : Dho : Age 57 : Income 110000
    3 : Lid : Age 40 : Income 460000
    4 : Wgeecnce : Age 43 : Income 370000
    and so on.
    These three pieces of data, Name,Age and Income were all generated randomly to be stored in an array of objects of class Person.
    Now what I must do is , read in this very file and re-create the array of objects that they were initially written from.
    I'm totally lost on how to go about doing this, I have only been learning java for the last month so anyone that can lend me a hand, that would be superb!
    Cheers!

    Looking at you other thread, you are able to create the code needed - so what's the problem?
    Here's an (not the only) approach:
    Create an array of the necessary length to hold the 3 variables, or, if you don't know the length of the file, create a class to contain the data. Then create an ArrayList to hold an instance of the class..
    Use the Scanner class to read and parse the file contents into the appropriate variables.
    Add each variable to either the array, or to an instance of the class and add that instance to the arraylist.

  • Extracting Array of objects from web service

    After a couple days of head banging I now have a webservice
    call executing and I am trying to extract / create a class from the
    ResultEvent:
    If the xml returned from the web service is:
    <people>
    <person name="Mike" />
    <person name="Dave" />
    </people>
    and the class is:
    class Person
    public var Name:String;
    The result event is:
    private function doResults(result:ResultEvent):void
    // how do I create an array of Person objects from result, I
    would also like to know how to create a typed array something like
    class PersonList if possible. I just need the raw how to loop the
    result and set the values on the class
    Thanks,
    Mike

    Well I wound up with just trial and error until I got it
    working, Im sure this will be improved as I go, but it's enough to
    press on with the app for now, this code is in the result function
    and result is the ResultEvent wich appears to be an array of
    generic objects representing the objects returned by the service.
    This in no way uses FDS and is talking to a simple dotnet / asp.net
    web service.
    // here app is a singleton class for app level data it is
    bindable and is used to update the view which in this example is
    bound to a public var MyObjects which in this case is an
    ArrayCollection, I unbox to MyObject in a custom view control
    for (var s:String in result.result)
    m = new MyObject();
    m.ID = result.result[s].ID;
    m.Name = result.result[s].Name;
    m.Type = result.result[s].Type;
    app.MyObjects.addItem(m);
    It also appears that you should create the WebService one
    time, and store refrences to the methods during app startup, the
    methods are called Operations and it appears you set the result and
    fault events then call send on the operation to get the data.
    // store this in a singleton app class
    var ws:WebService = new WebService();
    ws.wsdl = "
    http://dev.domain.com/WebService.asmx?WSDL";
    ws.addEventListener("result",doResults);
    ws.addEventListener("fault",doFault);
    ws.loadWSDL();
    // this is the operation which is also stored in the
    singleton app class
    var op:AbstractOperation = ws.getOperation("GetModules");
    // elsewere in the app we get the operation refrence setup
    result and fault and call send, then copy the generic object into
    our cutom classes using the first chunk of code above
    op.addEventListener("result",doResults);
    op.addEventListener("fault",doFault);
    op.send();
    I thought I would post this as I could find no such example
    in the offline or online docs, If anyone has a better way or see's
    a problem please post.
    I hope helps others with non FDS service calls and I look
    forward to hearing comments.
    Thanks,
    Mike

  • How can servlet return data as download file from browser ? !!! URGENT !!!

    My servlet query data from database and would like to return the data as text file.
    How can I return data to the browser as user click a file to download ?
    How can I set the file name ? (default name is the servlet name that I don't want it to be)
    Which content type should I return to browser to prevent browser to display data immediately but save instead ?
    Thank you very much !

    I am having the same issue. Did you ever discover a way to change the "file name" in the browser. I've tried changing numerous HTTP header fields, to no avail.
    Marc

Maybe you are looking for

  • Copy and Paste from Word to ID – as text please?

    Recently upgraded to CS4 and Office 2008. Now when I copy and paste text from Word to ID it only comes in as an image. If I'm copying a single paragraph from a lengthy Word doc, I really don't want to have to paste it into a new Word doc, save that,

  • Characters corrupted converting hpj+rtf to chm help

    Hi, Sorry this was originally posted in htmlhelp but there were no answers so I'm reposting here to see if anyone can help. I'm trying Robohelp to see if I can use it to create localised versions of our help files. I have the old .hlp project .hpj fi

  • Help for Seconds to Duration (hh:mm:ss) conversion

    I have this SubVI that is to convert Seconds to Duration (hh:mm:ss). This SubVI works fine for converting Seconds below 54000 (15:00:00) but the subsequent Seconds, for instance (57600 seconds), it returns Duration -8:00:00 instead of 16:00:00. My Su

  • Field UMSA1 cannot be converted in type CURR - long Text

    Hi All, I am getting the following error Error records written to application log Error in an arithmetic operation in record 489 Record 489:Contents 四川省长江滥曝扇备总 from field UMSA1 cannot Record 489 :Contents 四川省长江滥曝扇备总 from field UMSA1 cannot be convert

  • Is HLS protocol version 6 is supported in IOS 6.x and IOS 7.x ?

    Is the latest HLS protocol version (version 6) is supported in IOS 6.x and IOS 7.x players ? If it is supported can you please provide a sample m3u8 with EXT-X-START tag ?