Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to pass list from postman (chrome) to rest method

3469097Jul 10 2018 — edited Jul 13 2018

Hi all,

i am using JDeveloper 12.2.1.3.0 version ,

how to pass list from postman to rest method , below are the methods i am using,

main method(globalservicecomponents.java)

public List<EmployeeTest> createmultiEmpList( ArrayList<EmployeeTest> employee ){

        try         

        {

           System.out.println(" try:length "+employee.size());

                                   System.out.println(" try: createEmployee ");

           //  System.out.println( "employee\[0\].getEname()");

        }

        catch(Exception nothing)

        {

           System.out.println("Global Exception: createEmployee : ");

            emplist = new ArrayList\<EmployeeTest>(); 

                  EmployeeTest    \_current = new EmployeeTest("","");

            //     return new Employee(new BigDecimal("0"),"","",new BigDecimal("0"),null,new BigDecimal("0"),new BigDecimal("0"),new BigDecimal("0"));

            emplist.add(\_current);

           return  emplist;

        }

   //return employee;

        return employee ;//new EmployeeTest\[\]{ new EmployeeTest ("","")};

    }

POST method (restservice.java)

@POST

@Consumes(value = { "application/json"})

@Produces(value = { "application/json"})

@Path("/createmultiEmpList")

public List\<EmployeeTest> createmultiEmpList( ArrayList\<EmployeeTest>  Employee ){

    System.out.print("in rest method     ");

return getServiceComponent().createmultiEmpList(Employee);  //  am.createEmployee(employee);   

}

pastedImage_3.png

can any one tell me i am doing in the right way or not pastedImage_3.png

if not then what is the right way.

below rounded margin is for payload sample.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 10 2018
Added on Jul 10 2018
12 comments
11,699 views