Returning arrays from methods

Hello,
I'm trying to write a program that is structured like this;
- The first method gets the user to enter 20 integers, which are stored in an array.
- This method is then supposed to return this array.
- The main method calls the first method (the one with the array).
- The main method then calls another method which finds the highest value in the array passed to it (from the initial method) and then prints this value.
I've tried for about 2 hours now though, and can't get it to return the array.
Bear in mind I'm a novice at Java. I'll put my code below. Any help on this would be really appreciated because I'm totally stumped.
public class part1
     static int counter=20;
     public static void enterMarks()
               int classMarks[] = new int[20];
               for (int i=0; i<20; i++)
                         classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                         System.out.println();
                         System.out.print("The marks entered were ");
                         for (int j=0; j<counter; j++)
                                   System.out.print(classMarks[j]+", ");
     public static void max()
//               int[] classMarks2=classMarks;
     public static void main(String args[])
               int[] marks=enterMarks();
}Can someone tell me how I need to alter this so that the first method will return the array? Thanks in advance.

Thanks for all the help so far everyone, I'm finally getting somewhere, but I've another problem. Here's my current code:
     static int counter=20;
     public static int[] enterMarks()
               int classMarks[]= new int[counter];
               for (int i=0; i<counter; i++)
                         classMarks[i] = getScannerInput.anInt("Please enter an integer value between 0 and 20 for each mark :");
                         System.out.println();
                         System.out.print("The marks entered were ");
                         for (int j=0; j<counter; j++)
                                   System.out.print(classMarks[j]+", ");
                              return classMarks;     
     public static int max(int arr[])
               int[] marks = classMarks;
               int tempStore=0;
               for (int k=0;k<counter;k++)
                    if(marks[k]>marks[k+1])
                    tempStore=marks[k];
               return tempStore;
     public static void main(String args[])
               int[] marks = enterMarks();
}When I try to compile that, I'm told that the variable classMarks may not have been initialised. Surely it should be getting classMarks from the first method now that the first method is set up to return the array?

Similar Messages

  • Returning arrays from function

    Hi all,
    Can u please guide me in how to return an array from function .
    Is it possible or not ??
    If it is possible please tell me how to declare the function(prototype) that returns string array
    and how to return the string array..
    Thanks in Advance

    Hi all,
    Can u please guide me in how to return an array from
    function .
    Is it possible or not ??
    If it is possible please tell me how to declare the
    function(prototype) that returns string array
    and how to return the string array..
    Thanks in Advance
    public String [] methodReturnsAnArray()
    }

  • Please help how to get return array from rpg program on java code?

    Hi
    I have created a rpg program that returns 2 parameter 1 is the id and another one is list of array, when I called this program I passed two programparameter from my java code (see the code below) but when i checked what value would be return it is returned only first value of array. how will i get all array values ?
    please suggest me regarding this issues I amn't so much aware on java & AS400.
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(p2.toBytes(" "));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
    byte s[] = parmList[1].getOutputData(); // HERE I got only first value of returning array.
    parmList[1].getOutputDataLength();
    //String sts = ((String) (new AS400Text(10,o).toBytes(s[0])));
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();
    Reply With Quote

    Try this :
    try
    ProgramParameter[] parmList = new ProgramParameter[2];
    AS400Text p1 = new AS400Text(10);
    AS400Text p2 = new AS400Text(30);
    AS400Array arrP2 = new AS400Array(p2, 4);
    try
    parmList[0] = new ProgramParameter(10);
    parmList[1] = new ProgramParameter(30);
    parmList[0].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[1].setParameterType(ProgramParameter.PASS_BY_REFEREN CE);
    parmList[0].setInputData(p1.toBytes("Pune"));
    parmList[1].setInputData(arrP2.toBytes({"","","",""}));
    catch(Exception ex)
    ProgramCall pgm = new ProgramCall(o);
    pgm.setProgram("/QSYS.LIB/XXX/XXX.PGM",parmList);
    if (pgm.run())
         Object[] objArr =  (Object [])arrP2.toObject( parmList[1].getOutputData() );
         for(int i =0; i<objArr.length;i++){
                System.out.println( " SKU " + i +" : " + objArr.toString());
    else
    AS400Message[] messageList = pgm.getMessageList();
    for (int msg = 0; msg < messageList.length; msg++) {
    catch(Exception ex)
    AS400Message[] messageList = null;
    finally
    o.disconnectAllServices();

  • Returning Values from Methods

    We ran across some code in one of our classes that calls a private method. That method returns an object, but the code calling that method does not capture it. What happens to the return value in a case like this? I would have thought that to be a syntax error.
    Example:
    myMethod(myObject, i);  // Call to myMethod without capturing its return value.
    private myObject myMethod(MyObject myObject, int i) {
       return myObject;
    }What happens to the return value from myMethod?

    (void) f(arg1, ..., argN); There's no
    provision in Java to allow you express that same
    intention.
    What?!?!?public void f(arg1, ...,
    argN);
    In the C code, function f was defined as having a non-void return type.
    The statement
    (void) f(arg1, ..., argN);shows the caller is knowing ignoring that returned value.

  • Returned array from a method don't work properly over my Servlet

    Hi folks,
    I show you my code and then explain ;).
            double particle_sys[] = new double[100*5];
         double particle[];
      try {
             for(i = 0; i < 10; i++)
              particle_sys[i*5] = 1;
              particle_sys[i*5 + 1] = 0;
              particle_sys[i*5 + 2] = 1;
              particle_sys[i*5 + 3] = 0;
              particle_sys[i*5 + 4] = 0;     
         class call = new class();
         particle = call.MyFailingMethod(particle_sys);Now the code for the class which owns the method I call
    public class Jfjni
         static
                 System.loadLibrary("nativelibrary");
         public native void .........
         public double[] MyFailingMethod(double particle_sys[])
               double particle[] = new double[100*5];
               .... A call to a the native library to recibe the new data of particle_sys ....
             for(int i = 0; i < 10; i++)
              particle[i*5] = particle_sys[i*5];
              particle[i*5 + 1] = particle_sys[i*5 + 1];
              particle[i*5 + 2] = particle_sys[i*5 + 2];
              particle[i*5 + 3] = particle_sys[i*5 + 3];
              particle[i*5 + 4] = particle_sys[i*5 + 4];     
              return particle; 
    }A function in the native code changes the "particle_sys" array, but the returning value stills the same as the original passed to the function.
    Because of this, I have tested returning the array, dont works. I have tested also returning a copy of the array in "particle", dont works.
    Over standalone app and applet it runs correctly in all different ways, when I try it over a servlet the values of the array stand the same as before the method call.
    Please suggestions!
    Edited by: bifiado on Jan 15, 2008 10:27 AM
    Edited by: bifiado on Jan 15, 2008 10:28 AM

    I have partially solutioned this mistake but I have collateral ones. Looks like I forgot to put in web.xml the definition of the class I was calling from the principal servlet class. In other words, I have two classes, one is the extension of Httpservlet and the other (the class that make mistakes) is a class I call to do the JNI work.
    Now, I added in web.xml the definition of the JNI class (before I forgot) and looks the mistakes with arrays works, but know the there's a new problem and get an IOexception on the applet that call the servlet. When I coment the JNI calls the exception dissapears and all works ok, but I am not getting any exception report on the tomcat ".out".
    Please suggestions.

  • Need help on returning arrays from C++ to Java

    Hi all, I hava a C++ application that contains a method that will return a float array to Java. I was able to write the Java Code, the JNI code to call the C++ method and compile them successfully. However on calling the native method from Java, the data in the array returned was not what I want. Please look through my code and see what is wrong with it.
    My Java Code:
    public native float[] Statistics(int inputKey); // This is the native method
    public float[] Stats(int k){ //Java method to call the native method so that I can use it in a Bean for a JSP.
    inputKey = k;
    float[] p = new float[4];
    p = Statistics(inputKey);
    return p;
    For this native method, an integer is passed from Java to the native side and the native method will use this integer to generate a float array size of 4 and populate it with data and return it back to Java.
    My JNI code
    extern "C"
    JNIEXPORT jfloatArray JNICALL
    Java_com_jspsmart_upload_FinalWaterMark_Statistics(JNIEnv *env, jobject obj, jint inputKey)
         jfloatArray floatArray = env->NewFloatArray(4); //This creates a new Java floatArray to store the C++ array
         CWatermarker2App p; // This is the C++ class to be used
         jfloat *stats = p.OnWatermarkStatistics(inputKey) // The C++ method returns a float pointer for an array of size 4
         env->SetFloatArrayRegion(floatArray, 0 , 4 , stats); //storing the C++ float array into the Java float Array
         return floatArray; // return the Array to Java
    In this example, I should have the data returned as [4952.0 2529.0 1706.0 33.6] in the array.
    But i am getting junk instead like 2.53E-23, 1.402E-15 etc..
    Is this a type conversion mistake?
    Please help!

    The first thing I notice - probably not the problem - is the line defining p. There is no reason to define this as an array of size 4, because the return from the native method is going to wipe that definition, replacing it with the return value of the native method. Alternatives:
    1. float[] p = null.
    2. float[] p = Statistics(inputKey);
    3. return Statistics(k);

  • Having problem returning amount from method

    getting this error when i compile,cant figure out why...... thx for help
    Prog4.java:57: '.class' expected
                        double prem_bill = premium_bill(int day, int night);
    ^
    Prog4.java:57: ')' expected
                        double prem_bill = premium_bill(int day, int night);
    String name, input;
              char serv_code;
              int acct_num, day_mins, night_mins;
              for (int count = 1; count <= 5; count++)               //looping construct-will run 5 times
                   //Get name
                   name = JOptionPane.showInputDialog("What is your name?");
                   //Get acct_num
                   input = JOptionPane.showInputDialog("What is your account number?");
                   //Convert input to integer
              acct_num = Integer.parseInt(input);
                   //Get serv_code                                                  
                   input = JOptionPane.showInputDialog("Service code? (R-Regular, P-Premium)");     
                   serv_code = input.charAt(0);          
                   //Validate serv_code
                        while ((serv_code != 'R') && (serv_code != 'r') && (serv_code != 'P') && (serv_code != 'p'))
                             input = JOptionPane.showInputDialog("Error. (R-Regular, P-Premium)");     
                             serv_code = input.charAt(0);     
                   //Get minutes
                        if (serv_code == 'R' || serv_code == 'r')
                             input = JOptionPane.showInputDialog("How many minutes were used in the day?");
                             day_mins = Integer.parseInt(input);               
                             regular_bill(day_mins);
                        double reg_bill = regular_bill(day_mins);
                   //Display output(regular)
                             System.out.println("Hello " + name + ".");
                             System.out.println("Your account number is " + acct_num + ".");
                             System.out.println("Your service type is " + serv_code + ".");
                             System.out.println("Number of minutes used was " + day_mins + ".");
                             System.out.println("Your total is " + reg_bill + ".");
                        else
                             input = JOptionPane.showInputDialog("How many minutes were used in the day?");
                             day_mins = Integer.parseInt(input);
                             input = JOptionPane.showInputDialog("How many minutes were used in the night?");
                             night_mins = Integer.parseInt(input);
                             premium_bill(day_mins, night_mins);
                             int total_mins = day_mins + night_mins;
                        double prem_bill = premium_bill(int day, int night);
                   //Display output (premium)
                             System.out.println("Hello " + name + ".");
                             System.out.println("Your account number is " + acct_num + ".");
                             System.out.println("Your service type is " + serv_code + ".");
                             System.out.println("Number of minutes used was " + total_mins + ".");
                             System.out.println("Your total is " + prem_bill + ".");
         public static double regular_bill(int day)
              double result;          //Local variable
                   if (day > 50)
                        result = (((day - 50) * .2) + 10);
                   else
                        result = 10;
                   return result;
         public static double premium_bill(int day, int night)
              double result, day_total, night_total;          //Local variables
                   if (day > 75)
                        day_total = (((day - 75) * .1) + 10);
                   else
                        day_total = 25;
                   if (night > 100)
                        night_total = (((night - 100) * .05) + 10);
                   else
                        night_total = 25;
                        result = (day_total + night_total);
                   return result;
    }

    My quess is that you are trying to build a Customer-like class. I suggest that you should have two seperate classes. A Customer class, in which the constractor of the customer and the methods of the class should be located. Secondly you should implement a CustomerTester class, from which you can constract a new Customer object and call the methods you want. This has helped me a lot. In the tester class you can call the methods of your newly constructed object like: myCustomer.prenium_bill();
    As mentioned post your code accordingly so people here can help you                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Return array from Procedure

    can any one please tell me how to pass an dynamic array to a Procedure and get an dynamic array of values from Oracle.
    Thanks,
    Prasenjit

    PROCEDURE sp_error_report_summary(errorDate IN VARCHAR,
                                      RESULT1   OUT Types.ref_cursor,
                                      RESULT2   OUT Types.ref_cursor,
                                      RESULT3   OUT Types.ref_cursor) IS
        error_cursor Types.ref_cursor;
    BEGIN
        OPEN RESULT1 FOR
            SELECT error_message,
                   site_name,
                   COUNT(*) COUNT_MSG
            FROM   error_report
            WHERE  error_date = errorDate
            GROUP  BY error_message,
                      site_name
            ORDER  BY site_name;
        OPEN RESULT2 FOR
            SELECT * FROM registration;
        OPEN RESULT3 FOR
            SELECT * FROM category;
    END;

  • Returning String[] from C program

    How can I return a string[] from a cprogram to a java program?
    private native String[] readRFIDData();
    JNIEXPORT jobjectArray JNICALL Java_RfidDM_readRFIDData
    (JNIEnv *, jobject);
    Above is the definition of a jni method .
    I have gone through the sample code, but they explain how to return arrays from C++.
    Can someone please suggest? I am not good at C.
    Much thanks,
    Ann

    Thanks Scott.
    This code works fine for me...
         jclass sclass = (*env)->FindClass(env, "java/lang/String");
         jobjectArray ret = (*env)->NewObjectArray(env, length, sclass, NULL);
         for(i=0;i<37;i++){
              (*env)->SetObjectArrayElement(
                   env,ret,i,(*env)->NewStringUTF(env,&buf));     
              printf(&buf[i]);

  • Stored Procedure: Function returns Array

    I was just wondering if following scenario is possible in a stored procedure.
    I have a package, which includes 4 different functions and 1 procedure. Procdure uses ref cursor to return values in my reporting tool. What I am trying to do is to write a function which takes input and return array of varchar. Something like..
    Package ABC
    Function student_classes (student_no in Varchar2) return [array]
    begin
    select class_nbr into [array]
    from student_table
    where student_nbr = student_no;
    return [array];
    end student_classes;
    procedure students_info (rpt_cursor IN OUT rpt_type)
    begin
    OPEN rpt_cursor FOR
    select
    student_name,
    student_nbr,
    student_address,
    student_classes (student_nbr) --returns array
    from student_table;
    end student_info; --end of procedure
    end abc; --end of pacakge.
    I used [array], as I am ont sure how to define (syntax) it in spec part of package or in body. I will really appreciate if someone could help me with this function.
    Thank you

    Thanks for the reply Tonguc Y.
    I declared an array in my package declaration
    CREATE OR REPLACE PACKAGE rpt_TESTING_pkg
    AS TYPE rpt_type IS REF CURSOR;
         TYPE DIAGARRAY IS VARRAY(20) OF VARCHAR2(6);
         FUNCTION DIA_CODES (MNO IN VARCHAR2) RETURN DIAGARRAY;
         PROCEDURE member (rpt_cursor IN OUT rpt_type);
    END rpt_TESTING_pkg;
    but then when I try to use it in my function it gives me error that I should declare DIAGARRAY.
    CREATE OR REPLACE PACKAGE BODY rpt_TESTING_pkg
    as
    FUNCTION DIA_CODES (MNO IN VARCHAR2)
                   RETURN DIGARRAY AS diags DIGARRAY;
    begin
    <sql block>
    end dia_codes;
    end rpt_TESTING_pkg;
    Any suggestions.

  • Returing array from PL/SQL procedure

    Hi,
    I am trying to return array from PL/SQL procedure. Heres is the code. I am getting an error "OracleParameter.ArrayBindSize is invalid ".
    Will anybody let me know what is wrong in following code. or does anybody have code to return PL/SQL array using VB.NET.
    oCommand.CommandText = "MyPack.TestVarchar2"
    oCommand.CommandType = CommandType.StoredProcedure
    Dim id As Integer = 10
    Dim deptname As String()
    Dim oParam1 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("id", Oracle.DataAccess.Client.OracleDbType.Int32)
    Dim oParam2 As Oracle.DataAccess.Client.OracleParameter = New Oracle.DataAccess.Client.OracleParameter("deptname", Oracle.DataAccess.Client.OracleDbType.Varchar2)
    oParam1.Direction = ParameterDirection.Input
    oParam2.Direction = ParameterDirection.Output
    oParam1.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.None
    oParam2.CollectionType = Oracle.DataAccess.Client.OracleCollectionType.PLSQLAssociativeArray
    oParam1.Value = id
    oParam2.Value = ""
    oParam1.Size = 10
    oParam2.Size = 20
    oCommand.Parameters.Add(oParam1)
    oCommand.Parameters.Add(oParam2)
    oCommand.ExecuteNonQuery()
    Thanks
    Sameer

    Thanks Arnold for the reply..
    Yes, I am trying to get result set in array which is unknow to me (No of rows return by the query). For the test I will pre-define the result set so that I will able to set ArrayBindSize.
    I have read C# example but when I try to write it in VB.NET it gives me syntax error when I try to set the ArrayBindSize.
    oParam.ArrayBindSize = new int[3]{15,23,13} // individual max size of 3 outputsWill you please let me know how to set ArrayBindSize (VB.NET) because I am new to this..
    There is an example at otn "How to: Bind an Array to an ODP.NET Database Command" which does multiple INSERTs in one trip to database. This works fine. I need to do same for the SELECT statement which will return me multiple rows. I do not mean refCursor. If I use refCursor, it will make soft parse which I am trying to avoid using this Array techniq.
    Thanks
    Sameer

  • Remote Object - not able to get the returned value from java method

         Hi ,
    I am developing one sample flex aplication that connects to the java code and displays the returned value from the
    java method in flex client. Here I am able to invoke the java method but not able to collect the returned value.
    lastResult is giving null .  I am able to see the sysout messages in server console.
    I am using flex 3.2 and blazeds server  and java 1.5
    Here is the code what I have written.
    <?xml version="1.0" encoding="utf-8"?><mx:WindowedApplication  xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundColor="#FFFFFF" initialize="initApp()">
     <mx:Script><![CDATA[
    import mx.controls.Alert; 
    import mx.binding.utils.ChangeWatcher; 
    import mx.rpc.events.ResultEvent; 
    import mx.messaging.*; 
    import mx.messaging.channels.* 
    public function initApp():void { 
         var cs:ChannelSet = new ChannelSet(); 
         var customChannel:Channel = new AMFChannel("my-amf", "http://localhost:8400/blazeds/messagebroker/amf");     cs.addChannel(customChannel);
         remoteObj.channelSet = cs;
    public function writeToConsole():void {      remoteObj.writeToConsole(
    "hello from Flash client");
          var returnedVal:String = remoteObj.setName().lastResult;     Alert.show(returnedVal);
    //[Bindable] 
    // private var returnedVal:String; 
    ]]>
    </mx:Script>
    <mx:RemoteObject id="remoteObj" destination="sro" /> 
    <mx:Form width="437" height="281">
     <mx:FormItem>  
    </mx:FormItem>  
    <mx:Button label="Write To Server Console" click="writeToConsole()"/>
     </mx:Form>
     </mx:WindowedApplication>
    Java code
    public  
         public SimpleRemoteObject(){  
              super();     }
      class SimpleRemoteObject { 
         public void writeToConsole(String msg) {          System.out.println("SimpleRemoteObject.write: " + msg);     }
         public String setName(){          System.
    out.println("Name changed in Java"); 
              return "Name changed in Java";
    And I have configured destination in  remote-config.xml
    <destination id="sro">
       <properties>    
        <source>SimpleRemoteObject</source>
        <scope>application</scope>
       </properties>
      </destination>
    Please help me .

    You are not able to get the returned value because if you see the Remote object help you will realise you have to use result="resultfn()" and fault = "faultfn()"
    In this you define what you wish to do.
    More importantly in the remote object you need to define which method you wish to call using the method class like this
    <mx:RemoteObject id="remoteObj" destination="sro" result="r1" fault="f1"  >
         <Method name="javaMethodName" result="r2" fault="f2"/>
    <mx:RemoteObject>
    r2 is the function where you get the result back from java and can use it to send the alert.

  • Displaying array from another method

    Hello for this code I want to display the array from the first method in the second method although when I run it, it displays 6 times the whole array - well the the last iteration shows the whole array. I have only just started using different methods.
    Please could someone say why this is happening.
    Cheers
    John
    import java.util.*;
    public class Lottery
         public static void main(String[] argStrings)
              int[] lotteryArray = new int[6];
              for(int count = 0; count < 6; count++)
                   double randomNumber = Math.random();
                   double biggerRandom = (randomNumber * 50);
                   int integerNumber = (int)biggerRandom;
                   lotteryArray[count] = integerNumber;
                   displayNumbers(lotteryArray);
         public static void displayNumbers(int[] lotteryArray)
              System.out.println("Lottery numbers are:");
              for(int i = 0; i < lotteryArray.length; i++)
                   System.out.print(lotteryArray[i] + " ");
              System.out.println();
    }

    Well I know your right but actualy getting this to work for my program is proving hard. This is my progress so far:
    Cheers
    John
    public static void main(String[] argStrings)
              int[] lotteryArray = new int[6];
              int p = 0;
              boolean duplicate = false;
              while(p < 6)
                   for(int count = 0; count < lotteryArray.length; count++)
                        double randomNumber = Math.random();
                        double biggerRandom = (randomNumber * 50);
                        int integerNumber = (int)biggerRandom;
                        if (lotteryArray == lotteryArray[count])
                             duplicate = true;
                        if (duplicate == false) //not a duplicate
                             lotteryArray[++count] = integerNumber;
                   displayNumbers(lotteryArray);
         }

  • Return results from ADEP in AS3 Arrays, not ArrayCollections

    Hi all,
    Is there any way to force ADEP to return results from data services in simple AS3 Arrays, not ArrayCollections? Here are my situation:
    In my project I use ADEP Data Management Services. To connect to ADEP services we use RTMP channel defined in services-config.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <services-config>
         <services>
              <service-include file-path="remoting-config.xml" />
              <service-include file-path="proxy-config.xml" />
              <service-include file-path="messaging-config.xml" />
              <service-include file-path="data-management-config.xml" />
              <service-include file-path="managed-remoting-config.xml" />
              <service class="fiber.data.services.ModelDeploymentService" id="model-deploy-service" />
              <default-channels>
                   <channel ref="my-rtmp"/>
              </default-channels>
         </services>
         <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
              <endpoint url="rtmp://{server.name}:1000" class="flex.messaging.endpoints.RTMPEndpoint"/>
              <properties>
                   <idle-timeout-minutes>20</idle-timeout-minutes>
                   <block-rtmpt-polling-clients>true</block-rtmpt-polling-clients>
                   <rtmpt-poll-wait-millis-on-client>0</rtmpt-poll-wait-millis-on-client>
              </properties>
         </channel-definition>
    </services-config>
    To manage data in database we defined data services in data-management-config.xml like this:
    <?xml version="1.0" encoding="UTF-8"?>
    <service id="data-service" class="flex.data.DataService">
        <adapters>
            <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/>
            <adapter-definition id="mr-java-dao" class="flex.data.adapters.ManagedRemotingDataAdapter" />
            <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/>
        </adapters>
        <default-channels>
            <channel ref="my-rtmp"/>
        </default-channels>
        <destination id="SomeProduct.SomeItems">
            <adapter ref="java-dao" />
            <properties>
                <source>flex.data.assemblers.SQLAssembler</source>
                <scope>application</scope>
                <metadata>
                    <identity property="ID" />
                </metadata>
                <server>
                    <database>
                        <datasource>java:comp/env/jdbc/SP</datasource>
                    </database>
                    <actionscript-class>com.somecompany.classes.SomeCoolClass</actionscript-class>
                    <create-item>
                        <procedure name="SomeItems_Insert">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Division_ID#" />
                            <procedure-param property-value="#Salesrep_ID#" />
                            <procedure-param property-value="#Area_Code#" />
                            <procedure-param property-value="#Item_ID#" />
                        </procedure>
                        <id-query>SELECT IDENT_CURRENT('Work_Area_Item')</id-query>
                    </create-item>
                    <fill>
                        <name>all</name>
                        <procedure name="SomeItems_Get">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Last_Sync_Time#" />
                        </procedure>
                    </fill>
                    <update-item>
                        <procedure name="SomeItems_Update">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Division_ID#" />
                            <procedure-param property-value="#Salesrep_ID#" />
                            <procedure-param property-value="#Area_Code#" />
                            <procedure-param property-value="#Item_ID#" />
                       </procedure>
                    </update-item>
                    <delete-item>
                        <procedure name="SomeItems_Delete">
                            <procedure-param property-value="#Session_ID#" />
                            <procedure-param property-value="#Item_ID#" />
                        </procedure>
                    </delete-item>
                </server>
            </properties>
        </destination>
    </service>
    By default, ADEP returns results from SomeProduct.SomeItems destination to Flex side as ArrayCollection of SomeCoolClass instances but I need the data to be returned in simple AS3 Arrays. Recently, I found that there is small optional serialization configuration in channel-definition that should resolve my problem. So I updated my channel-definition in services-config.xml to this:
    <channel-definition id="my-rtmp" class="mx.messaging.channels.RTMPChannel">
         <endpoint url="rtmp://{server.name}:1000" class="flex.messaging.endpoints.RTMPEndpoint"/>
         <properties>
              <serialization>
                   <legacy-collection>true</legacy-collection>
              </serialization>
              <idle-timeout-minutes>20</idle-timeout-minutes>
              <block-rtmpt-polling-clients>true</block-rtmpt-polling-clients>
              <rtmpt-poll-wait-millis-on-client>0</rtmpt-poll-wait-millis-on-client>
         </properties>
    </channel-definition>
    However, result are still returned in ArrayCollections.
    Any ideas?
    Thanks in advance

    Thom Parker answered this here: http://forums.adobe.com/message/2614570#2614570
    Answer copied below:
    "The problem is that when the focus is on the text box
    it's in edit mode. It's only displaying the value interactively entered by
    the user, or as a consequence of the change event.  What you need to do is
    force the focus off of the text box in code.  You can do a little trick
    where you bounce it to a tiny transparent field, which then bounds the focus
    back so it doesn't look like the focus changed."
    What I ended up doing was calling up the dialog box, then using setfocus with no parameters to remove focus from the field, as follows:
    this.rawValue = this.dialogBoxFunction(this.rawValue); // passing current value so dialog box defaults to that value
    xfa.host.setFocus();
    Cheers,
    Marty.

  • Error returning large String arrays from web service

    Hi,
    I currently have an EJB that returns a String[] array that I have implemented as
    a Web Service. When I execute a Java client (JSP) from Weblogic, I don't have a problem
    as long as the returned array is relatively small, but when the array starts to get
    a little larger (say 20 elements, about 30 chars each), I consistently get:
    SAXException: java.lang.IllegalArgumentException:array element type mismatch.
    Strangely enough, when my web service client is a .asp page running under MS IIS
    (using the MS SOAP Toolkit), it works fine. I have returned as many as 15000 - 20000
    array elements in one call. And since I am calling the same Weblogic EJB with the
    MS client, I know it's a problem with the Java client, not the EJB.
    Anybody know of a bug or had this experience before? Or know what I might be doing
    wrong? FYI, I am using Weblogic 6.1 SP2.
    Thanks,
    Steve

    Hi Steve,
    Sure we're interested...I'll pass this along to the XML folks.
    Thanks for the feedback,
    Bruce
    Steve Alexander wrote:
    In case anyone is interested, I solved my problem. I was mis-diagnosing the problem
    - thinking it was a size issue when it actually was a data issue. On the calls where
    I was returning a large array, some of the array members were null. When I made them
    enpty strings "", it worked. Apparently the default SAX parser BEA uses doesn't like
    the nulls, whereas the MS parser doesn't care.
    "Steve Alexander" <[email protected]> wrote:
    Thanks Bruce,
    FYI - I have reproduced the problem on WL7.0. I have turned it in to support
    as you
    suggested.
    Steve
    Bruce Stephens <[email protected]> wrote:
    Hi Steve,
    This does not ring any bells, however I would suggest that you file a support
    case. If it
    is an option you might try a later release (7.0).
    Bruce
    Steve Alexander wrote:
    Hi,
    I currently have an EJB that returns a String[] array that I have implementedas
    a Web Service. When I execute a Java client (JSP) from Weblogic, I don'thave a problem
    as long as the returned array is relatively small, but when the arraystarts to get
    a little larger (say 20 elements, about 30 chars each), I consistentlyget:
    SAXException: java.lang.IllegalArgumentException:array element type mismatch.
    Strangely enough, when my web service client is a .asp page running underMS IIS
    (using the MS SOAP Toolkit), it works fine. I have returned as many as15000 - 20000
    array elements in one call. And since I am calling the same Weblogic
    EJB
    with the
    MS client, I know it's a problem with the Java client, not the EJB.
    Anybody know of a bug or had this experience before? Or know what I mightbe doing
    wrong? FYI, I am using Weblogic 6.1 SP2.
    Thanks,
    Steve

Maybe you are looking for

  • Using namespaces in the XML QUERY

    I need to included a namespace of i: in the query below. the namespace is : "http://abc.com/int:i" How can I include the namespace in the query below? Is this possible? SELECT XMLELEMENT("i:Trade", XMLELEMENT("i:Level",2.25),                         

  • Move 10.6.8 Dovecot to clean server setup 3.1.2

    Hi All, I am planing to do a clean Server.app 3.1.2 on 10.9.3 setup. I currently have a 10.6.8 Server running e-mail. Both are Dovecot but when I setup new Users on 10.9.3 they will have new GUID. The Dovecot mail directories will not match without s

  • Unable to connect to proxy due to automatic https

    Hi there, I am the network administrator for an Australian K-12 school. We are cross platform, and support both Mac & Windows environments, based of an Active Directory Infrastructure. We have local proxy server based on ISA 2006, using McAfee SmartF

  • Can you revert back to Lion after installing Mountain Lion?

    Since I have bought ML basically all my software (Saf,Mail,iTunes etc..) is not operating correctly. Safari drops out if I stop using after about 15min and the only way to get it working again is to do a hard (forced) re-start and this is constantly

  • Unity Connection MWI Issues ver 8.6.2ES25

    Hi Folks Can I just run this past you all please. Have just upgraded from unity 7 to connection 8.6. We have a hunt pilot number of 4136 with 4 hunt list member numbers in the hunt (1930, 1931, 1932 and 1933) 4136 is configured as the unity connectio