webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Not able to convert ArrayList of List to array in java service webmethods

    Posted Sun January 14, 2018 01:45 AM

    Below is my ArrayList:

    ArrayList<ArrayList> Record = new ArrayList<ArrayList>();

    I am using below code to get output:

    // pipeline
    IDataCursor pipelineCursor_1 = pipeline.getCursor();

    					// CalPattern
    IDataUtil.put( pipelineCursor_1, "Record", Record) ;
    IDataUtil.put( pipelineCursor_1, "message", message );
    
    idcout.destroy();
    pipelineCursor_1.destroy();
    

    But getting output in Object form with required value in it. I want output in IS document list.

    When I tried to convert ArrayList into Array as mentioned below , I have got an error:

    // pipeline
    IData[][] FinalRecord = Record.toArray(new IData[Record.size()][]);
    IDataCursor pipelineCursor_1 = pipeline.getCursor();

    					// CalPattern
    IDataUtil.put( pipelineCursor_1, "Record", FinalRecord) ;
    IDataUtil.put( pipelineCursor_1, "message", message );
    
    idcout.destroy();
    pipelineCursor_1.destroy();
    

    Error:java.lang.ArrayStoreException: null

    Please help!!


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 2.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Sun January 14, 2018 03:34 PM

    Can you explain your requirement and need for this java service?


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 3.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Tue January 16, 2018 02:31 PM

    Hi,

    I have document list as an input . Document list contains 12 strings each representing calendar month. Each string contains binary digits representing 0 as non working days and 1 as working days.

    Now I need to parse each string to get the output in a doc week wise. (E.g IS doc will contain 7 strings each represent week days…Monday =1, Tuesday=0…etc)

    so thats why I have taken two array lists for output:

    ArrayList CalPattern = new ArrayList();
    ArrayList<ArrayList> Record = new ArrayList<ArrayList>();

    :
    :
    :(some logic)
    :

    // create output object

    		output = IDataFactory.create();
    idcout = output.getCursor();
    :
    :
    IDataUtil.put.....
    :
    :
    
    CalPattern.add(output);}
    
    Record.add(CalPattern);
    
    IDataCursor pipelineCursor_1 = pipeline.getCursor();
    
    // CalPattern
    IDataUtil.put( pipelineCursor_1, "Record", Record.toArray(new IData[Record.size()][])) ;
    IDataUtil.put( pipelineCursor_1, "message", message );
    
    idcout.destroy();
    pipelineCursor_1.destroy();
    

    In the end I am converting Record array list of list into array but still getting output in object form.

    Answers to this problem will be appreciated!!


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Tue January 16, 2018 04:47 PM

    Record is type of ArrayList<ArrayList>, so after convert it to array, this is an ArrayList array, still can’t be recognized by webMethods, unless you could convert it to IData.


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 5.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Sat January 20, 2018 07:36 AM

    Could you please tell me how to convert ArrayList array to IData???


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 6.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Tue January 23, 2018 11:12 AM

    Try this for conversion…

    ArrayList docList=new ArrayList();
    docList.add(IData1);

    //conversion
    docList.toArray(new IData[docList.size]);


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: Not able to convert ArrayList of List to array in java service webmethods

    Posted Tue January 23, 2018 02:49 PM

    ArrayList can’t be converted to IData, only ArrayList<ArrayList> can. I saw your Record variable is ArrayList<ArrayList> type.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods