Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

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!

consuming BC4J REST webservice from java with parameters

zam_oraFeb 16 2018 — edited Feb 21 2018

Good day,

I am doing a ADF Application which contains some REST web service also. Using the Jdeveloper 12.2.1.2

I have created a custom method called 'createFinStat()' in the  VOImpl class and expose it as REST service (POST).

Below is the payload, which is working fine in postman tool

{

    "name" : "createFinStat",

    "parameters" : [

        {

            "deptNo" : "30"

        },

        {

            "secName" : "Finance"

        },

        {

            "level" : "02"

        }

    ]

}

--

But when i am calling from java using`jersey library, I am gettting null point exception.

Below is the code snippet . Is there anything missing, particularly while passing parameters.

Please advise.

Client c = Client.create();

WebResource r = c.resource(Constants.EntryURL);

MultivaluedMap reqPayload = new MultivaluedMapImpl();

String params = "{\"deptno\":\"30\",\"secName\":\"Finance\",\"level\":\"02\"}";

reqPayload.add( "name", "createFinStat");

reqPayload.add( "parameters", params);

ClientResponse resp = r.accept(MediaType.APPLICATION_JSON_TYPE).entity(reqPayload,"application/vnd.oracle.adf.action+json").post(ClientResponse.class);

Thanks

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Mar 21 2018
Added on Feb 16 2018
1 comment
275 views