Forum Stats

  • 3,727,527 Users
  • 2,245,403 Discussions
  • 7,852,848 Comments

Discussions

consuming BC4J REST webservice from java with parameters

zam_ora
zam_ora Member Posts: 249 Blue Ribbon

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

Answers

This discussion has been closed.